docker restart
Stops and then starts a container again.
In more detail
It is docker stop followed by docker start on the same container, keeping its writable layer. For automatic restarts after crashes or reboots use a restart policy instead.
Related terms
- docker stop — Asks a running container to shut down cleanly, then forces it if it does not.
- docker start — Starts a container that already exists, keeping its writable layer and settings.
- restart policy — A setting that tells Docker or Kubernetes whether to start a container again automatically after it exits.
Taught in
- Run, Stop, Restart And Remove A Container — Docker Architecture & Production Containers
- Environment, Secret Files And Runtime Restrictions — Docker Architecture & Production Containers