Create a container with an image. This is the basic premise.

docker pull centos
Copy the code

Create and start the container

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Copy the code

The OPTIONS that

Some have one minus sign, some have two minus signs

– name= New container name: Specify a container name. -d: Run the container in the background and return the container ID, that is, start the daemon container. -i: Runs the container in interactive mode, usually with -t. -t: reassigns a pseudo-input terminal to the container. It is usually used together with -i. -p: indicates random port mapping. – p: specified port mapping, IP has the following four formats: hostPort: containerPort IP: : containerPort hostPort: contai