{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/18473","labels_url":"https://api.github.com/repos/docker/docker/issues/18473/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/18473/comments","events_url":"https://api.github.com/repos/docker/docker/issues/18473/events","html_url":"https://github.com/docker/docker/issues/18473","id":120824092,"number":18473,"title":"Looking for \"unless-error\" restart policy","user":{"login":"bboreham","id":8125524,"avatar_url":"https://avatars.githubusercontent.com/u/8125524?v=3","gravatar_id":"","url":"https://api.github.com/users/bboreham","html_url":"https://github.com/bboreham","followers_url":"https://api.github.com/users/bboreham/followers","following_url":"https://api.github.com/users/bboreham/following{/other_user}","gists_url":"https://api.github.com/users/bboreham/gists{/gist_id}","starred_url":"https://api.github.com/users/bboreham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bboreham/subscriptions","organizations_url":"https://api.github.com/users/bboreham/orgs","repos_url":"https://api.github.com/users/bboreham/repos","events_url":"https://api.github.com/users/bboreham/events{/privacy}","received_events_url":"https://api.github.com/users/bboreham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-07T17:17:18Z","updated_at":"2015-12-07T17:17:18Z","closed_at":null,"body":"I have a container which needs to be restarted when the machine reboots.  If the process crashes or exits with an error I would like it to stay down so it can be diagnosed.\r\n\r\nExisting restart policies:\r\n* `on-failure` will not achieve either requirement.\r\n* `always` will achieve the first requirement but not the second.\r\n* `unless-stopped` is slightly better than `always`, but not quite what I want.\r\n\r\nI apologise if this is a misguided request; I searched around quite a lot but didn't find an open discussion of the topic.  I found [this](https://www.pivotfreight.com/devblog/on-docker-restart-policies) which asserts that `on-failure` will restart containers on a daemon restart, but this does not match my experiments or my reading of the code.  On a hard reset of the machine, the exit code will be recorded as zero so no restart.\r\n\r\nIn #7586 it is [asserted](https://github.com/docker/docker/issues/7586#issuecomment-57061376) that `always` has a max-retry count, and a max-retry count of 1 would be good enough for my purposes, but again this does not match what I find in the code."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/162597481","html_url":"https://github.com/docker/docker/issues/18473#issuecomment-162597481","issue_url":"https://api.github.com/repos/docker/docker/issues/18473","id":162597481,"user":{"login":"GordonTheTurtle","id":10620046,"avatar_url":"https://avatars.githubusercontent.com/u/10620046?v=3","gravatar_id":"","url":"https://api.github.com/users/GordonTheTurtle","html_url":"https://github.com/GordonTheTurtle","followers_url":"https://api.github.com/users/GordonTheTurtle/followers","following_url":"https://api.github.com/users/GordonTheTurtle/following{/other_user}","gists_url":"https://api.github.com/users/GordonTheTurtle/gists{/gist_id}","starred_url":"https://api.github.com/users/GordonTheTurtle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GordonTheTurtle/subscriptions","organizations_url":"https://api.github.com/users/GordonTheTurtle/orgs","repos_url":"https://api.github.com/users/GordonTheTurtle/repos","events_url":"https://api.github.com/users/GordonTheTurtle/events{/privacy}","received_events_url":"https://api.github.com/users/GordonTheTurtle/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T17:17:18Z","updated_at":"2015-12-07T17:17:18Z","body":"Hi!\n\t\nPlease read this important information about creating issues.\n\nIf you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.\n\nIf you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.\n\nThis is an automated, informational response. \n\nThank you.\n\nFor more information about reporting issues, see https://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting-other-issues \n\n-----------------------------\nBUG REPORT INFORMATION\n-----------------------------\nUse the commands below to provide key information from your environment:\n\n`docker version`:\n`docker info`:\n`uname -a`:\n\nProvide additional environment details (AWS, VirtualBox, physical, etc.):\n\n\n\nList the steps to reproduce the issue:\n1.\n2.\n3.\n\n\nDescribe the results you received:\n\n\nDescribe the results you expected:\n\n\nProvide additional info you think is important:\n\n\n----------END REPORT ---------\n\n\n\n#ENEEDMOREINFO\n"}}