Virtual Machine (VM) vs Docker

Hello guys, sorry to disturb you all... I just have a quick question about one of the tools used in DevOps. I was reading that Docker is one of the tool used. I've read a bit about it and from what I've understood, it's just a package/container that contains standardized units (runtime, dependencies, code, etc...) that can be run anywhere (when we say anywhere, this means on any OS and machine independent ?). My question is, why do we need to use docker... I've never used it but I know it's extensively used. I know when we need to "deploy" an app, we would use docker, but why ? When we say "deploy" an app using docker, where is it deploy? Last question, how is a docker different to a virtual machine and when is one better than the other? I read that VMs have specific resource allocated to them while they are running, while dockers share resources.
8 Replies
Jochem
Jochem3w ago
docker lets you define the environment the app will run in, in a way that requires (almost) zero configuration when you move it to different hardware or even a different OS it also means that if you need a second or third instance, that's really easy to do (depending on how your app is written and set up) as for the differences between a VM and docker, it's in the level of virtualization. Docker only virtualizes the application layer, where a VM virtualizes the OS Kernel as well. Basically, the black box your app exists in encompasses more with a VM than with docker, so docker containers are less demanding on host resources, but offer fewer options when it comes to configuration, and potentially slightly lower built-in security
Faker
FakerOP3w ago
Yep I see... I have a question, in real-world, why and where do we use VMs? I know for example, we have cloud services like AWS where we can "rent" VMs... we do that to set up kind of our own server on that? Say we want to develop a website for example. Our website need a server where to run, this is where we "rent" a VM?
Jochem
Jochem3w ago
that's one of the uses, yeah you can also own your own hardware and run VMs on there to divide a larger server into smaller ones for different purposes
Faker
FakerOP3w ago
Yep I see, thanks ! one question :c, which comes first, docker containers or docker images? I mean, do docker containers run docker images or it's the other way round? we first have the images, which are blueprints and from that we create containers which are application on their own ?
Jochem
Jochem3w ago
docker images are files you download, which are run by docker to create containers and the containers aren't applications, they're virtual environments for your code to run in
Faker
FakerOP3w ago
oh ok, basically, the images are configuration files? Based on that, we create a container, inside the container, there will be whatever was in the configuration file ? Like specific libraries, etc ? Then, what's our application ? :c
Jochem
Jochem3w ago
it's more than just configuration files, but yes
Faker
FakerOP3w ago
Yep I see, I guess I will understand it better when I will use it but I now have an overview of how things work, thanks !!

Did you find this page helpful?