How To Remove Docker Images

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-remove-docker-images/
PINTEREST
PINTEREST
INSTAGRAM

Docker uses images in order to start new container. New containers will use existing images and adds new layers for the customized parts. In this tutorial we will look how to manage docker images.

List Docker Images

Before removing Docker Images we generally need to list these images. We will use list command in order to list currently existing Docker Images.

List Docker Images

List Docker Images

Remove Specific Docker Image

The first example to remove Docker image is removing single image. We need to specify the image with its name or image id. We will use rmi command which is shortcut of remove image. In this example we will remove the image named ubuntu .

Remove Specific Docker Image

Remove Specific Docker Image

As we can see from output all layers related with ubuntu image is deleted. In the following example we will provide the image id.

Remove Specific Docker Image

Remove Specific Docker Image

List Dangling Docker Images

As we know docker images consist of different layers. These layers are used by multiple or single images. Sometimes layers can be unrelated with any image. We can list these unused and unrelated docker image layers with -f and dangling=true options.

Remove Dangling Docker Images

We can remove dangling images by one by one typing the docker image id  but this is not a feasible solution. We can list the dangling docker images id’s with -q parameter .

LEARN MORE  Linux rm Command Tutorial With Examles

List Docker Images With Specified Name and Regex

In enterprise environments there will be a lot of images we need to cope. We can use pattern search or regex with grep tool to filter and list specific named images. In this example we will list images those contains buntu in their names.

List Docker Images With Specified Name and Regex

List Docker Images With Specified Name and Regex

Remove Docker Images With Specified Name and Regex

We can use rmi to remove docker images those have specified names or patterns. In this example we will remove images those names have buntu .

List All Docker Images

We can use -a option to list all docker images.

List All Docker Images

List All Docker Images

Remove All Docker Images

We can also remove all docker images just using similar technique like previous examples. We will provide the image id’s to the rmi command.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-remove-docker-images/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)