Docker [Batch deletion of <none> tags]

Delete all Docker tags!

When you touch Docker, a lot of unnecessary images (** none tag **) will accumulate like this ~

$docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
portfolio_api             latest              9091a77d3e50        3 minutes ago       661MB
<none>                    <none>              bda133c88b3a        3 hours ago         659MB
portfolio_front           latest              206c69e39bc8        5 hours ago         325MB
<none>                    <none>              c9c1cc1f82af        3 days ago          325MB
<none>                    <none>              90b26537b543        3 days ago          659MB
rails_nuxt_docker_front   latest              6a76df1e3e15        8 days ago          652MB
rails_nuxt_docker_api     latest              f81ab2aa1da3        9 days ago          664MB
node                      14.11.0-alpine      b85fc218c00b        4 weeks ago         117MB
ruby                      2.7.1-alpine        b46ea0bc5984        3 months ago        52.3MB
postgres                  12.3-alpine         17150f4321a3        3 months ago        157MB
node                      14.4.0-alpine       3bf5a7d41d77        4 months ago        117MB

When these guys accumulate, GB is eaten and it is very troublesome.

$ docker rmi <IMAGE ID>

It's also troublesome to erase it with, so let's get the none tag at once and delete it!

Extract only none tag

--You can apply a search filter by adding the -f option to $ docker images. --You can specify the none tag (dangling image) with 'dangling = true'

$ docker images -f 'dangling=true'
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
<none>                    <none>              bda133c88b3a        3 hours ago         659MB
<none>                    <none>              c9c1cc1f82af        3 days ago          325MB
<none>                    <none>              90b26537b543        3 days ago          659MB

Batch deletion of the main subject

Put the above options into $ docker rmi! !! !!

$docker rmi $(docker images -f 'dangling=true')
Deleted: sha256:bda133c88b3a3aca1cdd971ffe23a2bea32295e782d1225b7753151f47c40e3d
Deleted: sha256:99c5e34963f7b0ae63427b9e24b1d66778daeda863c078f46476ea9229f17771
...

Recommended Posts

Docker [Batch deletion of <none> tags]
Introduction of Docker --Part 1--
Overview of Docker and containers
Creating a batch of Liferay
About simple operation of Docker
[Docker] Introduction of basic Docker Instruction
Understand the basics of docker
I've only heard of Docker ...