containers

docker restart

Stops and then starts one or more containers, preserving their configuration. Equivalent to docker stop followed by docker start.

docker restart [OPTIONS] CONTAINER [CONTAINER...]

Common flags

Flag Purpose
-t, --timeout Seconds to wait before killing (default 10)
-s, --signal Signal to send to the container (default SIGTERM)
CONTAINER One or more container names or IDs to restart

Examples

docker restart web

Restart a single container

docker restart -t 30 db

Give the DB 30s to flush before restart

docker restart $(docker ps -q)

Restart every running container

docker restart web api worker

Restart several services together

Gotcha

restart does not re-pull the image or pick up new env/mount flags — for those, docker rm + docker run (or compose up) are required. Restart policies (--restart=always) are separate from this command.

Related commands

← All Docker commands · Docker vs Kubernetes · Docker vs VMs