docker restart: Stop and Start a Container
Restart a container: stop it, then start it again.
docker restart stops and then starts a container in one command, reusing its config. This page covers the timeout and using it to recover a wedged service.
What it does
docker restart issues a stop (SIGTERM then SIGKILL after the grace period) followed by a start. The container keeps its configuration and writable layer, so it is the same container, just cycled.
Common usage
docker restart web
docker restart -t 30 web # 30s grace period
docker restart $(docker ps -q)Common errors in CI
If the container crashed on start it will exit again right after restart - fix the root cause rather than looping restarts. A container run with --rm is removed on stop, so docker restart errors with "No such container"; recreate it with docker run. In CI prefer fixing config over restart-as-a-retry.