Managing Docker Images
Managing Docker Images
Introduction
In this lab, you will learn how to search, pull, push and remove container images from the
docker registry.
Objective:
Search Image
Pull Image
Save/Load image
Commit container state
Export/Import Image
Tag Image
Cleanup
1 Ensure that you have logged-in as root user with password as linux.
# docker image ls
Output:
Output:
1.3 Let us search image by applying the filter, by executing the below command.
Output:
Output:
Note: By default, pull will get the Official latest image from the Docker hub.
# docker image ls
Output:
1.6 Let us pull an image from a specific repository, by executing the below command.
Output:
1.7 Let us list the images, by executing the below command.
# docker image ls
Output:
Output:
# ls -l alpine_backup.tar
Output:
1.11 Let us list the contents of the Tar ball, by executing the below command.
Output:
1.12 Let us remove the existing image to test loading the backup image, by executing the
below command.
# docker image rm alpine
Output:
# docker image ls
Output:
1.14 Let us load an image from the tar archive, by executing the below command.
Output:
1.15 Let us list the images, by executing the below command.
# docker image ls
Output:
1.16 Let us check the history of an image, by executing the below command.
Output:
Output:
2.2 Let us attach to the container to make few changes, by executing the below command.
Output:
2.3 Let us commit the container state as a new image, by executing the below command.
Output:
# docker image ls
Output:
2.5 Let us create a container out of new image, by executing the below command.
2.6 Let us verify the content of a newly created container, by executing the below command.
2.7 Let us check the difference made inside a container before the commit, by executing the
below command.
# docker container diff server01 | grep testFile
Output:
# ls -lh server02_latest.tar
Output:
3.3 Let us import the tarball as an image, by executing the below command.
Output:
# docker image ls
Output:
Output:
# docker image ls
Output:
Output:
3.8 Let us list the images, by executing the below command.
# docker image ls
Output:
Cleanup