Hello everyone, welcome to my Docker Tutorial for Beginners. Today, I am going to play with Docker Images. After you install Docker on your system, you don’t have any images. If you then create and run a new container, it will pull the image from the Docker Hub. In this article, you will find some basic image operations such as list images, pull images and remove images.
Before we jump into the actual command to list all images, you may want to have a look at the term “images” used in Docker world. A Docker image is built up from a series of layers. Each layer represents an instruction in the image’s Dockerfile. Each layer except the very last one is read-only. (Read More)
Table of Content
Docker Image Commands
Docker Image Help
From a Terminal console, you can execute the following command to display the docker image commands.
docker image --help
List All Images in Local repository
Now let’s try to list all images, use this command
docker image ls
or you can also use this command
After the command, you will see a list of any images in your local repository. If you don’t have any, it will return an empty list.
Pull Images from Docker Hub
docker pull [OPTIONS] NAME[:TAG|@DIGEST]
docker pull ubuntu:latest
The command will pull the ubuntu image from the registry. Make sure you are connected to the internet to perform this operation.
Remove Image Command
docker image rm [OPTIONS] IMAGE [IMAGE...]
docker image rm ubuntu
The command will remove the ubuntu image from your local repository.
Using the Docker image command is pretty easy. If you need help, simply execute the –help command to display any available command and options.