INTRODUCING DOCKER IMAGE AND COMMANDS

In Docker, everything is based on Images. Docker image is the collection of all files, libraries, binaries and other dependencies forming an executable software application, which can run everywhere without glitches. An Image is an ordered collection of root file system changes and the corresponding execution parameters for use within a container run time. An image typically contains a union of layered file systems stacked on top of each other. An image does not have state and it never changes.

Here are the points to be noted about Docker Image:

Docker image is read only i.e., the image and its content cannot be altered.

Although the alteration is not allowed in Docker, we are allowed to add the new layer with the changes.

After having many alterations, a docker image may be visualized as several layers one above another.

Parent and Child Images

The layering concept in docker images leads to the addition of required capabilities efficiently by adding a new layer to the existing one resulting in a new image.

Hence, the image has the parent-child relationship where the original image is termed as the base image upon which several child images are added.

Docker Registry

Docker Registry (Docker Repository) is a storage house for the Docker Images. It can be accessed publicly or privately by developers across the world.

Docker images can be sent to registry by using docker push

Docker images can be downloaded from the registry using docker pull sub command.

Docker push

Docker images can be uploaded to Docker hub using docker commands.

Let’s push an image to docker hub using push command.

upload an image to docker hub.

docker push <<image name>>
e.g. docker push nginx

Docker pull

Docker images can be downloaded from Docker hub using docker commands.

Let’s pull an image from docker hub using pull command.

Download a image from docker hub.

docker pull <<image name>>
e.g. docker pull nginx

Verify the downloaded docker images using below mentioned command.

The default docker images will show all top-level images, their repository and tags, and their size.

Docker images have intermediate layers that increase reusability, decrease disk usage, and speed up docker build by allowing each step to be cached. These intermediate layers are not shown by default.

docker images ↵

Remove Docker Images:

Docker images can be removed from Docker hub using docker rmi docker command.

docker rmi <<Image Name>> ↵
e.g. docker rmi nginx

Conclusion

An image is essentially built from the instructions for a complete and executable version of an application, which relies on the host OS kernel. When the Docker user runs an image, it becomes one or multiple instances of that container. A Docker Image is created by the sequence of commands written in a file called as Docker file.