Working with Docker Images
If you are a Docker developer, you might have noticed that working with multiple Docker Images at the same time might be quite overwhelming sometimes. Managing numerous Docker Images all through a single command line is a very hefty task and consumes a lot of time. In this article, we are going to discuss some important Docker Images commands that would make your life easier. Managing Images with the help of these commands will be very easy and will save you a lot of time.
1. Listing Docker Images
To list Docker Images in your local Docker repository, you can use this command.
sudo docker images
To list all the Docker Images including the intermediate images, you can provide -a flag.
sudo docker images -a
2. Listing the Images by their names and tags
You want to find out Images with specific names, you can use the following command.
sudo docker images <image-name>
If you want to list images with specific tags, you can use this command.
sudo docker images <image-name>:<tag-name>
3. Listing images with full-length IDs
Usually when you list Docker Images, only partial Image Ids (First 12 Characters) are displayed. To display Docker Images, with full-length Image Ids, you use the –no-trunc flag.
sudo docker images --no-trunc
4. Using filters to list Images
You can use the –filter option along with the list command, to filter out only desired Images.
For example, we will filter out only Ubuntu images below.
sudo docker --filter=reference='ubuntu'
5. Pulling Docker Images with specific tags
To pull Docker Images with specific tags or versions, you can use the following command.
sudo docker pull <image-name>:<tag-name>
In the below example, we will pull an alpine image with a specific version 3.7.