root@server:~# docker images -a
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<none> <none> 5e2dfc857e73 5 days ago 261.6 MB
<none> <none> d053e988f23d 5 days ago 261.6 MB
<none> <none> 1d5d4a2d89eb 5 days ago 261.6 MB
<none> <none> ea0d189fdb19 5 days ago 100.5 MB
<none> <none> 26c6175962b3 5 days ago 100.5 MB
<none> <none> 73d5cec4a0b3 5 days ago 100.5 MB
<none> <none> e19590e1bac1 5 days ago 100.5 MB
I've tried the following:
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
And the following:
docker rmi $(docker images -f "dangling=true" -q)
Get the following error:
docker: "rmi" requires a minimum of 1 argument.
See 'docker rmi --help'.
Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
Remove one or more images
The below command is working for me. this is just simple grep "" images and get the docker image id and removed all the images. Simple single command as it has to.
docker rmi $(docker images |grep "<none>"| awk '{print $3}')
Just remove the images using their IDs:
try
docker rmi -f $(docker images -a | awk 'NR> 1 || $2 = "<none>" {print $3}')
, while there may be cleaner commandsUpdated
Stated the following images where in use. I think this command gets rid of unwanted images.
You can try and list only untagged images (ones with no labels, or with label with no tag):
However, some of those untagged images might be needed by others.
I prefer removing only dangling images:
As I mentioned for for docker 1.13+ in Sept. 2016 in "How to remove old and unused Docker images", you can also do the
image prune
command:That being said, Janaka Bandara mentions in the comments:
Janaka references "How to Remove a Signed Image with a Tag" from Paul V. Novarese:
Note that Paul also mentions moby issue 18892:
Its simple and clear,
Even I took 3 days to understand this simple and crisp error.
The docker image is not built successfully
Then I removed the 8th line from Dockerfile, it was signal success this time.
It says successfully tagged dem:expo, this line is imp during docker process.