Restart policies, and what unhealthy does not do
Select an icon to see what it is.
Step 1 of 6
The policy is part of the container's config
--restart on-failure:3 becomes HostConfig.RestartPolicy in the create request. The name says when to restart and MaximumRetryCount says how often. dockerd stores it and applies it every time the container exits.
$ docker run -d --name flaky --restart on-failure:3 alpine sh -c 'exit 1' PrevNext
POST /v1.45/containers/create?name=flaky
{"Image": "alpine""HostConfig": {"RestartPolicy": {"Name": "on-failure""MaximumRetryCount": 3}}}