What is docker? (upper)

Chen Bucheng I 2022-06-24 07:17:35 阅读数:930

dockerupper

One . brief introduction

2013 Published since ,Docker It's been a lot of attention , Considered likely to change the software industry .

One of the biggest headaches of software development , It's environment configuration . for instance , you are here windows10 A game is installed on , Startup found that XXX dependent package is missing , After hard installation , Another error was reported , not to mind taking the trouble .

Even if it's something like steam This game integrator , Automatically help you install various dependencies , But some computers still lack some basic elements , After all, the initial system is a little different , Some people install ghost System , Some are pure systems .

Two . virtual machine

virtual machine (virtual machine) It's a solution with environment installation . It can run another operating system in one operating system , For example Windows Running in the system Linux System . The application is not aware of this , Because the virtual machine as like as two peas , And for the underlying system , Virtual machine is a common file , Delete... If you don't need it , No impact on the rest .

Although users can restore the original environment of software through virtual machine , For example, let you download a virtual machine when you install the game , Play in the virtual machine , Will ensure a consistent environment . however , There are several drawbacks to this scheme .

1. Too many resources Virtual opportunity monopolizes part of memory and hard disk space . When it's running , Other programs can't use these resources . Even the applications in the virtual machine , The only real memory used is 1MB, Virtual machines still need hundreds MB Memory to run .

2. There are many redundant steps Virtual machine is a complete operating system , Some system level steps , It's often impossible to skip , Such as user login .

3. Slow start How long does it take to start the operating system , How long does it take to start the virtual machine . It may take a few minutes , The application can actually run .

3、 ... and .Linux Containers

Because of these shortcomings of virtual machines ,Linux Another virtualization technology has been developed :Linux Containers (Linux Containers, Abbreviation for LXC).

Linux Container is not simulating a complete operating system , It's about isolating the process . Or say , There's a protective layer on the outside of the normal process . For processes in the container , All the resources it touches are virtual , So as to realize the isolation from the underlying system .

Because the container is process level , There are many advantages over virtual machines . 1. Fast start Applications in containers , Directly is a process of the underlying system , Instead of processes inside the virtual machine . therefore , Starting the container is equivalent to starting a process on the machine , Instead of starting an operating system , It's a lot faster .

2. Less resources Container takes only needed resources , Do not occupy the resources that are not used ; Virtual machine is a complete operating system , It's inevitable to occupy all resources . in addition , Multiple containers can share resources , Virtual machines are exclusive resources .

3. Small volume The container only needs to contain the components used , Virtual machine is the package of the whole operating system , So container files are much smaller than virtual machine files .

All in all , Containers are a bit like lightweight virtual machines , Able to provide virtualized environment , But the cost is much smaller .

copyright:author[Chen Bucheng I],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/175/20210702150335477f.html