{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/21359","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/21359/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/21359/comments","events_url":"https://api.github.com/repos/docker/docker/issues/21359/events","html_url":"https://github.com/docker/docker/issues/21359","id":142283568,"number":21359,"title":"confused restart policy","user":{"login":"ZYNCMA","id":6066621,"avatar_url":"https://avatars.githubusercontent.com/u/6066621?v=3","gravatar_id":"","url":"https://api.github.com/users/ZYNCMA","html_url":"https://github.com/ZYNCMA","followers_url":"https://api.github.com/users/ZYNCMA/followers","following_url":"https://api.github.com/users/ZYNCMA/following{/other_user}","gists_url":"https://api.github.com/users/ZYNCMA/gists{/gist_id}","starred_url":"https://api.github.com/users/ZYNCMA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZYNCMA/subscriptions","organizations_url":"https://api.github.com/users/ZYNCMA/orgs","repos_url":"https://api.github.com/users/ZYNCMA/repos","events_url":"https://api.github.com/users/ZYNCMA/events{/privacy}","received_events_url":"https://api.github.com/users/ZYNCMA/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-21T08:24:46Z","updated_at":"2016-03-21T10:26:19Z","closed_at":"2016-03-21T10:26:19Z","body":"I have read the introduction on https://docs.docker.com/engine/reference/run/#restart-policies-restart, but I'm really confued about **on-failure, always and unless-stopped**. \r\nIt seems that these restart policies work depending on the exit status of containers, but when I ran `docker stop` on a container and its exit staus became 137, none of those three restart policies restarted the container.\r\nSo what exit status actually means? If the restart policy doesn't work on `docker stop` or `docker kill` or anything else, can you detail more?\r\nBy the way, is there a way to **actually always restart** a container, even if it's stopped by `docker stop` or `docker kill`?"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/199214902","html_url":"https://github.com/docker/docker/issues/21359#issuecomment-199214902","issue_url":"https://api.github.com/repos/docker/docker/issues/21359","id":199214902,"user":{"login":"thaJeztah","id":1804568,"avatar_url":"https://avatars.githubusercontent.com/u/1804568?v=3","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T10:26:19Z","updated_at":"2016-03-21T10:26:19Z","body":"If you manually stop a container (`docker stop foo`), docker won't restart that container until the daemon is restarted. Having a restart *does* restart the container in other situations. If you (for example) send a `kill` to the process that's running in the container, docker will automatically restart the container and increment the restart-count;\r\n\r\n    docker run -d --restart=always --name foo nginx\r\n\r\nFind the process and kill it;\r\n\r\n    ps aux | grep nginx\r\n    ....\r\n    kill 28127\r\n\r\nAnd see that the container's RestartCount is incremented;\r\n\r\n    docker inspect --format \"{{ .RestartCount }}\" foo\r\n    1\r\n\r\n\r\nHope this helps!\r\n\r\n\r\nI'll close this issue, because the GitHub issue tracker is *not* a general support forum, but for reporting bugs and feature requests. For these kind of questions, it's better to use;\r\n\r\n- forums.docker.com\r\n- the #docker IRC channel on freenode\r\n- StackOverflow\r\n\r\nFeel free to comment here after I've closed"}}