Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between "docker start" and "docker restart"?

As it relates to stopping/starting a container?

After stopping a container:

docker stop <container id>

It seems like I can run either "start" or "restart" to bring it back up. I'm wondering if there is any difference, or if they are functionally equivalent:

docker restart <container id>
docker start <container id>
like image 353
blindsnowmobile Avatar asked Nov 02 '16 04:11

blindsnowmobile


People also ask

What is the difference between docker start and restart?

A restart policy only takes effect after a container starts successfully. In this case, starting successfully means that the container is up for at least 10 seconds and Docker has started monitoring it. This prevents a container which does not start at all from going into a restart loop.

What does docker restart do?

The Docker Engine must reload configuration information if any changes are made to the Docker configuration. To do this, you must restart the docker service. If you edit the /etc/sysconfig/docker configuration file while the docker service is running, you must restart the service to make the changes take effect.

What is the difference between docker run and docker start?

Docker start command will start any stopped container. If you used docker create command to create a container, you can start it with this command. Docker run command is a combination of create and start as it creates a new container and starts it immediately.

What is docker start command?

Description. The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command. That is, docker run is equivalent to the API /containers/create then /containers/(id)/start .


1 Answers

The docker restart command will issue a stop and then a start. If the container is already stopped, it is functionally the same as docker start. The difference is if you are trying to do the operation on a container that may or may not be running, docker restart is more robust in this situation.

like image 113
programmerq Avatar answered Oct 23 '22 18:10

programmerq