What is a Docker Image?

Dhathri Vupparapalli
3 min readJul 17, 2021

--

Let us understand what a docker image is.

What is a Docker Image?

A Docker image is an immutable file that contains all the libraries, source code, and other scripting files which are needed to run an application. An image is nothing but a collection of layers that packs all the necessary tools like dependencies, configuration, etc which in turn provides a fully functional container environment. The bottom-most layers mostly will be a Linux-based image and the topmost layer will be the application layer (The image which we want to use).

These images are stored in a Docker registry like Docker Hub. For example, in the below image we have a node image that has been downloaded from the Docker hub.

Node image has been downloaded from docker hub

Here we can see that the ‘node’ image is downloaded with all the layers (0bc3020do5f1, a110e5871660, 83d3c0fa203a, etc) that are necessary for the node container to run. These layers of images are read-only files. If we don't specify anything after ‘node’ we get the latest node version. We can also specify specific versions. For eg., docker pull node:16.4.2-alpine3.11. To view all the image details in our system we can use the docker images command.

list of images on the system.

We can see that the image contains some attributes like:

  • TAG — It indicates the version of the image.
  • IMAGE ID — This is the unique id given for every image. We use an image id to delete a specific image.
  • CREATED — The period of time since it was created.
  • SIZE — indicates virtual image’s size.

Key Takeaways:

  1. Images are read-only files.
  2. Images are collections of layers that contain all the required test scripts, source code libraries that are necessary for an application to run virtually.
  3. Images are stored on a Docker registry like Docker hub or on a local registry.
  4. Use the docker pull command to get an image from the docker hub.
  5. Docker images can be moved easily from one team to another team.

Read difference between Docker and Virtual Machine to know more about docker.

Conclusion:

Image is a read-only file that can be pulled from the docker hub. Images can be moved from one team to another team. After reading this article, you should now have a good understanding of what a Docker image is. Now that you know what a docker image is read about the Docker container to understand more about it.

Related article:

--

--