Docker Create, Start and Run Exec区别

Create?adds a writeable container on top of your image and sets it up for running whatever command you specified in your?CMD. The container ID is reported back but it’s not started.

Start?will start any stopped containers. This includes freshly created containers.

Run?is a combination of create and start. It creates the container and starts it.

docker exec — will execute a command in a container is already running.

参考:https://nickjanetakis.com/blog/docker-tip-61-difference-betweeen-docker-create-start-and-run

 

用-d 参数可以在后台运行。https://stackoverflow.com/questions/30209776/docker-container-will-automatically-stop-after-docker-run-d

发表评论