Difference between image and container - Containerization cencepts

+6 votes
I'm a beginner with containerization concepts, I'm very confused with what is an image and what is a container and how are apps or websites deployed using these.

Can somebody explain?
Sep 11, 2018 in Docker by lina
• 8,110 points
329 views

3 answers to this question.

+4 votes
Entire concept of docker and Kubernetes is containerization, hence it's very important to understand the basic concept of docker images and containers.

Image is the base on which you instantiate containers. Now what is image and container?

Images basically contain softwares like operating systems, MySQL, notepad, etc. and data sets like .java, .class etc.

Imagine containers to be boxes inside which images run. Suppose yo have an image, lets say jdk, when this image is made to run inside a conatiner, it can run java codes without having to install jdk on your system.

So basically containers contain the binary grouping of all the binaries and dependencies that your app requires to give a succesful output.

Images never start by themselves they, only start when run inside a container.
answered Sep 12, 2018 by Kalgi
• 42,510 points
+3 votes
Talking in programming terms or oops terminology,

images are classes or templates.

and containers are instances of a class i.e. it's an object.
answered Sep 12, 2018 by Hannah
• 16,710 points
+2 votes

Pretty simple @lina. Images and Containers are the same, barring one difference. 

Think of it this way, Images are inert (inactive) volumes containing everything your application needs to run. Containers however are the active version of images which actually hosts your application. 

Images and Containers work like Car and Fuel.
Without their compatriot/ partner, they are useless. And when they are working together, we are happy for what is being produced.

In other words, Images are the templates with all the data about the app. When the image is executed, a Container is created which actually contains that app.

For a better understanding of how this works, watch this video of mine. I've explained it as clearly as possible with diagrams, demo, etc: https://www.youtube.com/watch?v=h0NCZbHjIpY

answered Sep 12, 2018 by Vardhan
• 12,740 points

Related Questions In Docker

0 votes
2 answers

What is the difference between a Docker image and a container?

Here is very basic explanation for image ...READ MORE

answered Sep 4, 2018 in Docker by Damon Salvatore
• 5,510 points
991 views
0 votes
1 answer

What is the difference between “expose” and “publish” in Docker?

Basically, you have three options: Neither specify EXPOSE nor -p -> ...READ MORE

answered Jul 18, 2018 in Docker by Nilesh
• 6,880 points
447 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,940 points
231 views
0 votes
4 answers

what is network namespace and how we can access network namespace for the container?

Hey @Ali, I'll just combine @Eric, @Jackie ...READ MORE

answered Dec 20, 2018 in Docker by Kalgi
• 42,510 points
596 views
0 votes
1 answer

How to create a container and run images in docker?

Look for what all images you have ...READ MORE

answered Feb 22 in Docker by Kalgi
• 42,510 points
117 views