The difference between docker run and docker start

Note, both docker run and docker start run a docker container, the difference is

1. docker run (using mirror image)

docker run is to create a new container and run it (put the image into the container and start the container)
(Container ID is not required, and the behavior of marking to the virtual machine is equivalent to creating a new virtual machine and starting it)

docker run is usually followed by startup parameters, such as:
 docker run -it --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
 docker  run  -d  -p  80 :80  httpd
docker run -d -p 80:80 httpd

Parameter description:
 -i: run the container in interactive mode, usually used together with -t; 
-t: reallocate a pseudo-input terminal for the container, usually used together with -i; 
–name: specify a name for the container; 
-p: Specify port mapping, the format is: host (host) port: container port; 
-e: set environment variables; 
-d: running image name, and return the container ID;

2. docker start (use container ID or container NAMES)

​​​​​​​​docker start container ID/container, is to start an old container
docker start 6529h82014c2
docker start intelligent
(You can follow the container ID to mark the behavior of the virtual machine, which is equivalent to starting the virtual machine)

Similar usage is also:
*Stop the container: docker stop container ID
          docker stop 6529h82014c2
          docker stop 

*Restart the container: docker restart container ID  
          docker restart 6529h82014c2

Guess you like

Origin blog.csdn.net/weixin_43460193/article/details/128494767