Skip to content

Instantly share code, notes, and snippets.

@rockerBOO
Last active February 21, 2018 18:52
Show Gist options
  • Save rockerBOO/8340383 to your computer and use it in GitHub Desktop.
Save rockerBOO/8340383 to your computer and use it in GitHub Desktop.
Containers, Images in docker

Error: Conflict, * wasn't deleted

Recently trying out docker and was playing with Dockerfile. I ran my Dockerfile a few times and it made a few containers for the different build tries.

sudo docker build -t rockerboo/web .

docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
rockerboo/web       latest              57575666258f        2 minutes ago       542.7 MB
<none>              <none>              e157a88c6e6b        2 minutes ago       542.7 MB
<none>              <none>              2b823e316c3b        10 minutes ago      542.7 MB
<none>              <none>              97205609a8e8        32 minutes ago      542.6 MB
<none>              <none>              1ff57f10b000        33 minutes ago      541.8 MB
<none>              <none>              759adaaf687e        41 minutes ago      541.8 MB

Trying to remove an image docker rmi 57575666258f it would say Error: Conflict, 57575666258f wasn't deleted. This error is trying to tell you that it can't remove the image because its being used by a container.

To get a list of all the containers docker ps -a and then you can see the containers that are using the image.

CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                NAMES
0d4c1e223500        57575666258f        /bin/sh -c service p   27 minutes ago      Exit 0                                   sick_newton
f0923d332692        57575666258f        /bin/sh -c service p   27 minutes ago      Exit 0                                   hungry_tesla

Remove the containers.

docker rm 0d4c1e223500; docker rm f0923d332692

Now you can properly remove the images.

docker rmi 57575666258f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment