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>
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.
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.
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.
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 .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With