Skip to content

How to Remove Old and Unused Docker Images

If you need to remove any old and unused Docker images, then you can do the following:

How to Remove Old and Unused Docker Images

Firstly you need to see all the images:

docker images
Code language: Bash (bash)

You can also use ls to see the Docker Images:

docker image ls
Code language: Bash (bash)

How to Remove a Single Docker Image

The docker rmi command will remove a single Docker image as follows:

docker rmi <image_id>
Code language: Bash (bash)

You can also use the Docker image names as follows:

docker rmi ubuntu something
Code language: Bash (bash)

How to Remove Dangling Docker Images

docker images -f dangling=true
Code language: Bash (bash)

It’s also possible to prune images as follows:

docker image prune
Code language: Bash (bash)

You can also automatically find all the images and remove them directly:

docker rmi $(docker images -q -a)
Code language: Bash (bash)

See also  How to Fix 'no basic auth credentials' with Docker and AWS ECR
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x