Why I can't rm docker image?
I run container A from image A
Then, I do change something in container A and commit this container to image B
- Why Docker resets connection upon pushing an image to a private registry?
- Pulling from a local docker image instead
- Unable to build Dockerfile Error: Unable to access jarfile /dev/docker-files/billing/wlp-extended-184.108.40.206.jar
- Keeping a Play framework app running in a Docker container without a pseudo-TTY
- Cannot attach debugger to a node.js application running inside a Docker container in host-mode
- Run docker build in ubuntu:16.04 docker
I run container B from image B and
rm -fcontainer A
rmiimage A but it not work.Docker said container B is using it.
So my question is,I run container B from image B but why docker say the container B is using image A when I want
rmi image A.
My docker version:
Client version: 1.7.1 Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 786b29d OS/Arch (client): linux/amd64 Server version: 1.7.1 Server API version: 1.19 Go version (server): go1.4.2 Git commit (server): 786b29d OS/Arch (server): linux/amd64
2 Solutions collect form web for “Why I can't rm docker image?”
Your image B is based on image A. It inherits all the image layers used in image A. And it adds the new image layer that you created by committing your new image B.
So image A remains always in your image layer revision tree as a dependency when you use image B. As long as you have a running container using image B you cannot delete image A.
This is exactly the intended behavior. You have effectively created a Layer(Image) B on top of Layer(Image) A.
Where Layer B is the delta of the operations on Layer A. This is based on the Union File System and is described in the context of docker at: Understanding Docker
I would say that you are now running container B, which is depending on ImageA (Providing the error). However the root issue is that Image B depends on ImageA.