How is Docker different from a virtual machine?

前端 未结 20 2689
闹比i
闹比i 2020-11-21 22:36

I keep rereading the Docker documentation to try to understand the difference between Docker and a full VM. How does it manage to provide a full filesystem, isolated network

20条回答
  •  逝去的感伤
    2020-11-21 23:26

    There are three different setups that providing a stack to run an application on (This will help us to recognize what a container is and what makes it so much powerful than other solutions):

    1) Traditional Servers(bare metal)
    2) Virtual machines (VMs)
    3) Containers
    

    1) Traditional server stack consist of a physical server that runs an operating system and your application.

    Advantages:

    • Utilization of raw resources

    • Isolation

    Disadvantages:

    • Very slow deployment time
    • Expensive
    • Wasted resources
    • Difficult to scale
    • Difficult to migrate
    • Complex configuration

    2) The VM stack consist of a physical server which runs an operating system and a hypervisor that manages your virtual machine, shared resources, and networking interface. Each Vm runs a Guest Operating System, an application or set of applications.

    Advantages:

    • Good use of resources
    • Easy to scale
    • Easy to backup and migrate
    • Cost efficiency
    • Flexibility

    Disadvantages:

    • Resource allocation is problematic
    • Vendor lockin
    • Complex configuration

    3) The Container Setup, the key difference with other stack is container-based virtualization uses the kernel of the host OS to rum multiple isolated guest instances. These guest instances are called as containers. The host can be either a physical server or VM.

    Advantages:

    • Isolation
    • Lightweight
    • Resource effective
    • Easy to migrate
    • Security
    • Low overhead
    • Mirror production and development environment

    Disadvantages:

    • Same Architecture
    • Resource heavy apps
    • Networking and security issues.

    By comparing the container setup with its predecessors, we can conclude that containerization is the fastest, most resource effective, and most secure setup we know to date. Containers are isolated instances that run your application. Docker spin up the container in a way, layers get run time memory with default storage drivers(Overlay drivers) those run within seconds and copy-on-write layer created on top of it once we commit into the container, that powers the execution of containers. In case of VM's that will take around a minute to load everything into the virtualize environment. These lightweight instances can be replaced, rebuild, and moved around easily. This allows us to mirror the production and development environment and is tremendous help in CI/CD processes. The advantages containers can provide are so compelling that they're definitely here to stay.

提交回复
热议问题