Docker Image commands
The following are the some of the Docker Image Commands that are widely used:
List Docker Images
docker images
Example:
$ docker ls
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 0d9c6c5575f5 4 days ago 126MB
ubuntu 18.04 47b199b0cb85 2 weeks ago 64.2MB
Pull an Docker Image From a Registry
docker image pull <image-name>
Example:
$ docker pull alpine:3.11
3.11: Pulling from library/alpine
Digest: sha256:9f11a34ef1c67e073069f13b09fb76dc8f1a16f7067eebafc68a5049bb0a072f
Status: Downloaded newer image for alpine:3.11
Docker Images Prune
- The Docker Image Prune will remove the unused Docker Images that are not associated with any containers. The Command looks as follows:
docker image prune
Docker Images Filter
- When we want to filter some specific images we can filter out them using its labels or its meta information tags with the option –filter. The command looks as follows:
docker image ls -f "reference=mypython-app"
Remove an Image from Docker
- The following command is used for removing the docker image from the local registry:
docker rmi <id-of-image>
Example:
$ docker rmi <image_id>
Untagged: <image_id>
Deleted: sha256:<image_id>
Searching for a specific image on Docker Hub
docker search ubuntu
Example:
$ docker search ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian-based Linux operating s… 4458 [OK]
ubuntu-upstart Upstart is an event-based replacement for … 62 [OK]
tutum/ubuntu Simple Ubuntu docker images with ssh access 49 [OK]
ansible/ubuntu14.04-ansible
What is Docker Image?
Docker Image is an executable package of software that includes everything needed to run an application. This image informs how a container should instantiate, determining which software components will run and how. Docker Container is a virtual environment that bundles application code with all the dependencies required to run the application. The application runs quickly and reliably from one computing environment to another.
Table of Content
- What is Docker Image?
- SubCommands of Docker Image
- Docker Image Prune
- Docker Image Build
- Docker Image Tag
- Uses of Docker Images
- Difference between Docker Image VS Docker Container
- Structure Of Docker Image
- How To Create A Docker Image And Run It As Container?
- How to Build Docker Python Images? A Step-By-Step Guide
- Docker Image commands
- Docker Images – FAQs