{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/11414","labels_url":"https://api.github.com/repos/docker/docker/issues/11414/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/11414/comments","events_url":"https://api.github.com/repos/docker/docker/issues/11414/events","html_url":"https://github.com/docker/docker/issues/11414","id":62169020,"number":11414,"title":"Docker Image Removal Bug By Id","user":{"login":"danielrolnick","id":10928950,"avatar_url":"https://avatars.githubusercontent.com/u/10928950?v=3","gravatar_id":"","url":"https://api.github.com/users/danielrolnick","html_url":"https://github.com/danielrolnick","followers_url":"https://api.github.com/users/danielrolnick/followers","following_url":"https://api.github.com/users/danielrolnick/following{/other_user}","gists_url":"https://api.github.com/users/danielrolnick/gists{/gist_id}","starred_url":"https://api.github.com/users/danielrolnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielrolnick/subscriptions","organizations_url":"https://api.github.com/users/danielrolnick/orgs","repos_url":"https://api.github.com/users/danielrolnick/repos","events_url":"https://api.github.com/users/danielrolnick/events{/privacy}","received_events_url":"https://api.github.com/users/danielrolnick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-16T18:23:44Z","updated_at":"2015-03-17T12:34:36Z","closed_at":null,"body":"There is a bug with image removal where an image with multiple tags will be allowed to be removed regardless of whether that image is in use or not if you try to remove by id.\r\n\r\nSteps to Reproduce:\r\n\r\n    # docker pull drolnick/spin:v2\r\n    Pulling repository drolnick/spin\r\n    38b8f2f5dc2b: Download complete \r\n    511136ea3c5a: Download complete \r\n    36669626e49c: Download complete \r\n    d5570ef1464a: Download complete \r\n    b3936f269611: Download complete \r\n    Status: Downloaded newer image for drolnick/spin:v2\r\n\r\n    # docker run -d drolnick/spin:v2\r\n    800851c61645b15161e3631dac59db6fa2dc98de9d43e3ac17c688ef7b7193d6\r\n\r\n    # docker rmi 38b8f2f5dc2b\r\n    Untagged: drolnick/spin:v2\r\n    Untagged: drolnick/spin:v2_1\r\n    Untagged: drolnick/spin:v2_3\r\n    Deleted: 38b8f2f5dc2b34f428f778abca5c982ec8b36d0e4c63d3e943882eea2dac1946\r\n    Deleted: b3936f26961179f0fe7e217c13236497af012980139c307d6402d9d4d6c5d50a\r\n    Deleted: d5570ef1464a43fe282dd2705b38a2d739812b0b8036a49cfa09811737cfbed4\r\n    Deleted: 36669626e49c623f3b2aea41052bbc9de0506807d92137bf76c0fd3264eaff34\r\n    Deleted: 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158\r\n\r\n    # docker images\r\n    REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE\r\n\r\nCompare that to the effect that happens when you do the following\r\n\r\n    # docker pull drolnick/spin:v2\r\n    Pulling repository drolnick/spin\r\n    38b8f2f5dc2b: Download complete \r\n    511136ea3c5a: Download complete \r\n    36669626e49c: Download complete \r\n    d5570ef1464a: Download complete \r\n    b3936f269611: Download complete \r\n    Status: Downloaded newer image for drolnick/spin:v2\r\n\r\n    # docker run -d drolnick/spin:v2\r\n    800851c61645b15161e3631dac59db6fa2dc98de9d43e3ac17c688ef7b7193d6\r\n\r\n    # docker rmi drolnick/spin:v2\r\n    Untagged: drolnick/spin:v2\r\n\r\n    # docker rmi drolnick/spin:v2_1\r\n    Untagged: drolnick/spin:v2_1\r\n\r\n    # docker rmi drolnick/spin:v2_3\r\n    Error response from daemon: Conflict, cannot delete 38b8f2f5dc2b because the running container 800851c61645 is using it, stop it and use -f to force\r\n    FATA[0000] Error: failed to remove one or more images \r\n\r\n    # docker images\r\n    REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE\r\n    drolnick/spin       v2_3                38b8f2f5dc2b        About an hour ago   84.98 MB\r\n\r\nWe tracked this down to **docker/daemon/image_delete.go**  The function DeleteImage only checks  canDeleteImage if there is only a single tag mapping to an image.  \r\n\r\n    # docker version\r\n    Client version: 1.5.0\r\n    Client API version: 1.17\r\n    Go version (client): go1.4.1\r\n    Git commit (client): a8a31ef\r\n    OS/Arch (client): linux/ad64\r\n    Server version: 1.5.0\r\n    Server API version: 1.17\r\n    Go version (server): go1.4.1\r\n    Git commit (server): a8a31ef\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/82322281","html_url":"https://github.com/docker/docker/issues/11414#issuecomment-82322281","issue_url":"https://api.github.com/repos/docker/docker/issues/11414","id":82322281,"user":{"login":"colinmorelli","id":1615780,"avatar_url":"https://avatars.githubusercontent.com/u/1615780?v=3","gravatar_id":"","url":"https://api.github.com/users/colinmorelli","html_url":"https://github.com/colinmorelli","followers_url":"https://api.github.com/users/colinmorelli/followers","following_url":"https://api.github.com/users/colinmorelli/following{/other_user}","gists_url":"https://api.github.com/users/colinmorelli/gists{/gist_id}","starred_url":"https://api.github.com/users/colinmorelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinmorelli/subscriptions","organizations_url":"https://api.github.com/users/colinmorelli/orgs","repos_url":"https://api.github.com/users/colinmorelli/repos","events_url":"https://api.github.com/users/colinmorelli/events{/privacy}","received_events_url":"https://api.github.com/users/colinmorelli/received_events","type":"User","site_admin":false},"created_at":"2015-03-17T12:34:36Z","updated_at":"2015-03-17T12:34:36Z","body":"@x1022as that clears it up a lot. In our case, all instances have the same repo name, which explains the difference in behavior. I agree with #11058 (`docker rmi -f <image>`) should remove *all* repos/tags and the underlying image"}}