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
docker stop
Gracefully stops one or more running containers by sending SIGTERM and then SIGKILL after a timeout. Use docker kill for an immediate SIGKILL.
docker start
Starts one or more previously created or stopped containers using their existing configuration. Unlike docker run it does not create a new container.
docker run
Creates and starts a new container from a specified image in a single step. This is the primary command for launching workloads and supports extensive configuration for networking, storage, and process control.
docker compose
Manages multi-container applications defined in a compose.yaml file. This is the Compose V2 plugin invoked via 'docker compose' (space); the legacy hyphenated 'docker-compose' binary is deprecated.
docker ps
Lists containers along with their status, ports, and identifiers. By default it shows only running containers unless -a is passed.
← All Docker commands · Docker vs Kubernetes · Docker vs VMs