You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/part-1/section-1.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,9 +74,13 @@ Isn't there already a solution for this? Virtual Machines are not the same as Co
74
74
75
75

76
76
77
-
The difference between a virtual machine and Docker solutions arises after moving Application A to an incompatible system "Operating System B". Running software on top of containers is almost as efficient as running it "natively" outside containers, at least when compared to virtual machines.
78
77
79
-
So containers have a direct access to your own Operating Systems kernel and resources. The resource usage overhead of using containers is minimized, as the applications behave as if there were no extra layers. As Docker is using Linux kernels, Mac and Windows can't run it without a few hoops and each have their own solutions on how to run Docker.
78
+
Virtual Machines (VMs) run on a [hypervisor](https://en.wikipedia.org/wiki/Hypervisor), which virtualizes the physical hardware. Each VM includes a full operating system (OS) along with the necessary binaries and libraries, making them heavier and more resource-intensive.
79
+
Containers, on the other hand, share the host OS kernel and only package the application and its dependencies, resulting in a more lightweight and efficient solution.
80
+
81
+
VMs provide strong isolation and are suited for running multiple OS environments, but they have a performance overhead and longer startup times. Containers offer faster startup, better resource utilization, and high portability across different environments, though their isolation is at the process level, which may not be as robust as that of VMs. Overall, VMs could be used for scenarios needing complete OS environments, while containers excel in lightweight, efficient, and consistent application deployment.
82
+
83
+
Docker relies on Linux kernels, which means that macOS and Windows cannot run Docker natively without some additional steps. Each operating system has its own solution for running Docker. For example, Docker for Mac uses under the hood actually a virtual machine that runs a Linux instance, within which Docker operates.
80
84
81
85
## Running containers ##
82
86
@@ -146,19 +150,19 @@ Keep in mind that we are downloading stuff from the internet. Double checking wh
146
150
147
151
:::
148
152
149
-
So that's an image?
153
+
So what's an image?
150
154
151
155
## Image and containers
152
156
153
157
Since we already know what containers are it's easier to explain images through them: Containers are instances of images. A basic mistake is to confuse images and containers.
154
158
155
159
Cooking metaphor:
156
160
157
-
Think of a container as a ready-to-eat meal that you can simply heat up and consume. An image, on the other hand, is the recipe or ingredients for that meal.
161
+
Think of a container as a ready-to-eat meal that you can simply heat up and consume. An image, on the other hand, is the recipe *and* the ingredients for that meal.
158
162
159
163
So just like how you need a recipe and ingredients to make a meal, you need an image and a container runtime (Docker engine) to create a container. The image provides all the necessary instructions and dependencies for the container to run, just like a recipe provides the steps and ingredients to make a meal.
160
164
161
-
In short, an image is like a blueprint or template, while a container is an instance of that blueprint or template.
165
+
In short, an image is like a blueprint or template and the building material, while a container is an instance of that blueprint or template.
162
166
163
167
### Image
164
168
@@ -187,7 +191,7 @@ RUN <install some dependencies>
187
191
CMD <command that is executed on `docker container run`>
188
192
```
189
193
190
-
and is the instruction set for building an image. We will look into Dockerfiles later when we get to build our own image.
194
+
and is the instruction set for building an image. We will look into Dockerfiles later when we get to build our own images.
191
195
192
196
If we go back to the cooking metaphor, as Dockerfile provides the instructions needed to build an image you can think of that as the recipe for images. We're now 2 recipes deep, as Dockerfile is the recipe for an image and an image is the recipe for a container. The only difference is that Dockerfile is written by us, whereas image is written by our machine based on the Dockerfile!
0 commit comments