Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is Docker light weight

Tags:

linux

docker

I was reading about docker . I have understood that the platform helps in removing dependencies between different software life cycles by combining the dependencies and the software together.

In the website of docker it was written that it is light weight , I didn't get that point as how it can be light weight when it has all the dependencies packaged along with it?

If I have multiple containers in my system that uses the same dependency i.e say we use the same external library in all the containers , will that dependency be installed again and again for all the containers??

I am new to Docker and thus any help would be great to me.

like image 355
kkk Avatar asked Feb 08 '23 02:02

kkk


1 Answers

docker is sometimes described as "light weight" in comparison to virtual machines because it:

  • does not boot a separate OS per VM and is therefore faster to start/stop
  • In most scenarios requires less disk space due to sharing of common layers across images
  • Again due to the image layering, incremental deployments of new app versions are smaller and therefore faster than VMs
  • Shares a kernel across containers and therefore uses less memory

Of course this is largely marketing speak, "light weight" is neither technical nor specific. Take it with a grain of salt.

If I have multiple containers in my system that uses the same dependency i.e say we use the same external library in all the containers , will that dependency be installed again and again for all the containers??

If you do it properly, your multiple containers will share a common base layer and therefore not have multiple copies of those external libraries occupying disk space.

I have one more question , If I have a number of micro services , then will each micro service take a container ??

Yes, generally you have one main process per container, and a microservice is an independent process.

like image 160
Peter Lyons Avatar answered Feb 13 '23 04:02

Peter Lyons