Day-40 Docker Images and Containers

Photo by Ian Taylor on Unsplash

Day-40 Docker Images and Containers

Docker Image vs Docker Containers

ยท

2 min read

So far, we've looked at why we need Docker and containerization, as well as what microservices are. But the question still remains: what exactly is a container?

What is that

Container

A container is like a box in which you put all your code and other configurations and then ship it in the form of Docker image to the image hub or image registry, like Docker Hub.

Others can download that image and use Docker to run your code without installing anything. Docker will handle the installation and other configurations. But for that, you should have Docker installed on your PC.

You might be wondering what Docker Image is and how it differs from "Container."

tenor.gif

Let's find out.

Docker Images

You can recall Docker images as classes from object-oriented programming, which are templates to build objects. Same here: images work as templates to create containers. It is basically an immutable snapshot of the container.

Untitled-2022-11-14-2122.png

You can create Docker images using docker build command, and when you run docker run command, it will run a container of that image. You can create multiple containers from the same image.

Screenshot from 2022-11-23 10-47-11.png You can pull images from Docker Hub(An online docker image registry) using docker pull command.

Docker Installation ๐Ÿง‘โ€๐Ÿ”ง

You can install Docker on all available operating systems.

Resources ๐Ÿ“š

So that was all about Docker images and Docker containers. Stay tuned for more such blogs.

Did you find this article valuable?

Support Shivlal Sharma by becoming a sponsor. Any amount is appreciated!

ย