Debug School

Mohan
Mohan

Posted on

What is a Docker image and how is it different from a Docker container?

What is Docker Image?
The concept of Image and Container is like class and object, in which an object is an instance of a class, and a class is the blueprint of the object. Images are different in Virtual Machines and dockers. In virtual machines, images are just snapshots of running virtual machines at different points in time, but Docker images are a little bit different. The most important and major difference is that Docker images are immutable. That is they can not be changed. In the real world, it happens a lot that software works on one computer but it does not work on others due to different environments. This issue is completely solved by docker images and using this, the application will work the same on everyone’s PC. Every developer on a team will have the exact same development instance. Each testing instance is exactly the same as the development instance. Your production instance is exactly the same as the testing instance. Also, developers around the world can share their Docker images on a platform called DockerHUB.

What is Docker Container?
They are actually Docker Virtual Machines but are commonly called Docker Containers. If a Docker image is a map of the house, then a Docker container is an actually built house, or in other words, we can call it an instance of an image. As per the official website, a container is a runnable instance of an image. You can create, start, stop, move, or delete a container using Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state. An application runs using a cluster of containers that are self-isolated from one another and also from the host machine where they are running.

Top comments (0)