The un-tagged images and if you no longer used the images, this would be occupied the disk space in your instance so we can remove it. First listing out the docker image and remove which are displaying with
Just listing out the docker image using the command,
$ docker images -a
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
15bdbeb4a883 10 days ago 474 MB
eeb5ef226f19 11 days ago 315 MB
3bcf71042cd9 12 days ago 281 MB
1fd8e1b0bb7e 13 days ago 102.5 MB\
$ docker images --no-trunc | grep '' | awk '{ print $3 }' | xargs -r docker rmi
--no-trunc => Don't truncate output
grep => Filter the tag
awk => Filter the image ID
xargs => Converts input from standard input into arguments to a command
docker rmi => Remove one or more docker images
Still if the docker image is not removing and showing the report like below you can add an option "--force"
Deleted: sha256:11aab54d5ab835024b2b5e80c93d18368fa98730c2075e17b9add7356cbdd4e3
Deleted: sha256:95ab692eb5f3a9827d4a5044909b6e1857b649f2c0f5a4890cb814443afaa69a
Deleted: sha256:6630808c4fd193b2fb4f9aacf3254acaf73db3368095fb5ba37f21ceb855ab32
Deleted: sha256:87fddb313198de512a45d14a7337e62782adb67aef7280ff44a589c9e15cce23
Error response from daemon: conflict: unable to delete a49733a9a721 (must be forced) - image is being used by stopped container ba283fb42e27
Error response from daemon: conflict: unable to delete a33bfe10a233 (must be forced) - image is being used by stopped container f37058486fcd
Error response from daemon: conflict: unable to delete 61c5f6da8e86 (must be forced) - image is being used by stopped container b28b10656578
Error response from daemon: conflict: unable to delete b1889e74997c (must be forced) - image is being used by stopped container 2bf5ef62df3b
Error response from daemon: conflict: unable to delete 7d4809eeaa07 (must be forced) - image is being used by stopped container 622df663d508
The command is,
$ docker images --no-trunc | grep '' | awk '{ print $3 }' | xargs -r docker rmi --force
Comments (0)