How To Remove Anonymous Image In Docker?

362 views Asked by At

So, I want to create an image for my app using

docker build .

But I forgot to give it a name and the name became <none>. When I tried to remove this with docker image rm <none> The output is

bash: syntax error near unexpected token `newline'

How to remove this anonymous image?

1

There are 1 answers

0
Deadly Pointer On

List images with

docker images --all

There you will find an image ID for each image, e.g:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              2622e6cca7eb        4 months ago        132MB

You can delete the image by image ID like this:

docker image rm -f 2622e6cca7eb