Click here to Skip to main content
15,668,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm talking about docker right now. I was wondering why there are not only images but also containers here? I understand that container that runing from instance of image. Okay, we get that, so why do we need this separately? Wouldn't it be right to run it only with images? What's the need for images to turn into containers later?

What I have tried:

I just wondering why are these term exist in computer science? For an example, we write our own code in .java extension file and once we run the whole project our .java extension file compiled .class file?
Updated 9-Dec-22 11:46am

1 solution

Your question is unclear. The computer world has more than 2 things—while bit states can be only 2; 0, and 1.

The concept of images and containers is the same as class and objects. You write the class in your Java file, and when that code runs, the classes (when instantiated) become objects. The separation is to make it clear that while the class code is shared, each class instance (the object) can have its state and perform its operations. Similarly, each image specifies the code it executes and the resources it consumes. But, each container that is running can receive requests from different clients and provide a response back to them.
Wouldn't it be right to run it only with images
You're right. You run the Docker-based apps with images. But how would you distinguish between images and "running images"?

The running images are the containers. Each container exposes various details and properties that are not available with an image; such as a terminal that can be used to execute certain commands.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900