Unable to delete an image due to 'No such container'

I followed the suggestiion here:

The image no longer appears under docker ps -a but it still appears in docker image ls:

REPOSITORY              TAG            IMAGE ID       CREATED        SIZE
hello-world             latest         74cc54e27dc4   4 months ago   10.1kB
rockylinux              8.6.20227707   8cf70153e062   2 years ago    196MB
rockylinux/rockylinux   8.6            523ffac7fb2e   2 years ago    196MB

I’m trying to remove rockylinux/rockylinux.

Error response from daemon: No such container: rockylinux/rockylinux

Docker has a fabulous documentation. You should acquaint yourself with it :slight_smile:
Even the help should get you started in most cases: docker <command> --help.

So in your case: docker image --help. Which should have shown you that there is a rm sub command.

What you want to use is docker image rm.

2 Likes

Websites were showing docker rm <image name> instead of docker image rm <image name>.
Thank you.

docker rm is the short form of docker container rm, which removes a container, not the image. To remove the image from disk, use docker image rm.

2 Likes

If you saw that somewhere in the documentation, please, share where you have seen it, so we can inform the maintainers of the documentation. It shouldn’t mention “image name” after “docker rm”.

There is a very similar command which is “docker rmi <image name>” with just an additional “i” that means “image”. it could be easy to miss that sometimes either when reading or when writing..

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.