# docker restart: Stop and Start a Container

> How docker restart works: stopping then starting a container, the grace-period timeout, and using it to recover services in CI.

Source: https://latchkey.dev/learn/command-reference/docker-restart-command  
Updated: 2026-06-25

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

```Terminal
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.

## FAQ

### docker restart: Stop and Start a Container?

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 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
