☰ See All Chapters |
docker pull
docker pull command is a standard command for downloading the existing Docker images from registry.
Docker also maintains the Dockerfile for the existing docker images in their GitHub repositories. You can also use those Dockerfile and can see exactly what is included in the build and customize it.
Syntax of docker pull command
docker image pull <imagename>:<tag> |
Or you can just call docker pull by not adding image keyword as below:
docker pull <imagename>:<tag> |
From the above two syntax, docker image pull <imagename>:<tag> is the recent, preferred version.
There are larger number image operatig of sub-commands available from the “docker image” command For example, the following are just a few of the sub-commands available with “docker image”
docker image build
docker image history
docker image import
docker image inspect
docker image rm
docker image tag
The old form, “docker pull”, is retained for backwards compatibility, as are many other, related commands.
docker pull command Example
docker image pull alpine:latest |
If you want to download all versions of image, you should use –a flag. This is not recommended, this will download unnecessary images which you will not going to use. You should download all versions of images only when necessary. When –a flag is used you should not specify the tag.
docker image pull -a alpine |
Docker Search
When you are not sure with the tag/version you can search the images, it will provide all the available image versions with their description and ratings. You can search the available images that best fit your need. Use docker search subcommand to search in registry.
Example: docker search oracle
Search images are ordered based on their star rating.
docker images
To list out all the images that are available in your local docker machine you can run docker images command. docker images command will show all top level images, their repository and tags, and their size. From the below image, you can see there are many number of alpine images which is a result of downloading all images with –a flag in docker pull command which we executed earlier.
From the above image we can see that alpine:latest, alpine:3.12, alpine:3.12.1 are the three different versions of same image having same image id. Hence same image can have different versions. The docker pull subcommand will always download the image latest image version that has the latest tag in that repository. However, if you choose to download an image variant other than the latest, then you can do so by qualifying your image with the tag name by appending the tag to the repository/image name with a : (colon) that is added between the tag and the repository name (<repository>:<tag>).
All Chapters