{"action":"opened","issue":{"url":"https://api.github.com/repos/moby/moby/issues/36189","repository_url":"https://api.github.com/repos/moby/moby","labels_url":"https://api.github.com/repos/moby/moby/issues/36189/labels{/name}","comments_url":"https://api.github.com/repos/moby/moby/issues/36189/comments","events_url":"https://api.github.com/repos/moby/moby/issues/36189/events","html_url":"https://github.com/moby/moby/issues/36189","id":293951412,"number":36189,"title":"Docker container restart flag ignored","user":{"login":"FrenchBen","id":3965324,"avatar_url":"https://avatars0.githubusercontent.com/u/3965324?v=4","gravatar_id":"","url":"https://api.github.com/users/FrenchBen","html_url":"https://github.com/FrenchBen","followers_url":"https://api.github.com/users/FrenchBen/followers","following_url":"https://api.github.com/users/FrenchBen/following{/other_user}","gists_url":"https://api.github.com/users/FrenchBen/gists{/gist_id}","starred_url":"https://api.github.com/users/FrenchBen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrenchBen/subscriptions","organizations_url":"https://api.github.com/users/FrenchBen/orgs","repos_url":"https://api.github.com/users/FrenchBen/repos","events_url":"https://api.github.com/users/FrenchBen/events{/privacy}","received_events_url":"https://api.github.com/users/FrenchBen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-02T16:45:54Z","updated_at":"2018-02-02T16:45:54Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**Description**\r\n\r\nDocker run contains a `--restart` flag policy, which is as follow:\r\nhttps://docs.docker.com/engine/reference/run/#restart-policies-restart\r\nThe `always` value is described as:\r\n```\r\nAlways restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container.\r\n```\r\nDoing so with Docker 17.12 doesn't seem to work anymore\r\n\r\n**Steps to reproduce the issue:**\r\n1. Start a container with the `--restart=always` policy \r\n```bash\r\n$ docker run --name=ngin --restart=always -d -P nginx\r\n```\r\n2. Observe the container was started successfully:\r\n```bash\r\n$ docker ps\r\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                   NAMES\r\nc94d57016837        nginx               \"nginx -g 'daemon of…\"   2 minutes ago       Up 2 minutes        0.0.0.0:32768->80/tcp   ngin\r\n```\r\n3. Restart your instance/dockerd and observe that the container doesn't come up:\r\n```bash\r\n$ docker ps\r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES\r\n$\r\n```\r\n\r\n**Describe the results you received:**\r\nThe container wasn't started after a `dockerd` restart\r\n\r\n**Describe the results you expected:**\r\nThe container to be started on daemon start.\r\n\r\n**Additional information you deem important (e.g. issue happens only occasionally):**\r\nThis seems to be related to the binary shipped in Docker for Mac, Docker for AWS, Docker for Azure\r\n\r\n**Output of `docker version` from Broken LinuxKit:**\r\n```\r\nClient:\r\n Version:\t17.12.0-ce\r\n API version:\t1.35\r\n Go version:\tgo1.9.2\r\n Git commit:\tc97c6d6\r\n Built:\tWed Dec 27 20:05:03 2017\r\n OS/Arch:\tlinux/amd64\r\n\r\nServer:\r\n Engine:\r\n  Version:\t17.12.0-ce\r\n  API version:\t1.35 (minimum version 1.12)\r\n  Go version:\tgo1.9.2\r\n  Git commit:\tc97c6d6\r\n  Built:\tWed Dec 27 20:12:30 2017\r\n  OS/Arch:\tlinux/amd64\r\n  Experimental:\tfalse\r\n```\r\n\r\n**Output of `docker version` from Working Ubuntu on ec2:**\r\n```\r\nClient:\r\n Version:\t1.01.0-ce\r\n API version:\t1.35\r\n Go version:\tgo1.9.2\r\n Git commit:\t03596f5\r\n Built:\tWed Jan 10 20:11:05 2018\r\n OS/Arch:\tlinux/amd64\r\n Experimental:\tfalse\r\n Orchestrator:\tswarm\r\n\r\nServer:\r\n Engine:\r\n  Version:\t18.01.0-ce\r\n  API version:\t1.35 (minimum version 1.12)\r\n  Go version:\tgo1.9.2\r\n  Git commit:\t03596f5\r\n  Built:\tWed Jan 10 20:09:37 2018\r\n  OS/Arch:\tlinux/amd64\r\n  Experimental:\tfalse\r\n```\r\n\r\n/cc @justincormack @rn"}}
{"actor":{"display_login":"FrenchBen"}}