How is Docker different from a virtual machine?

前端 未结 20 2653
闹比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:19

    I have used Docker in production environments and staging very much. When you get used to it you will find it very powerful for building a multi container and isolated environments.

    Docker has been developed based on LXC (Linux Container) and works perfectly in many Linux distributions, especially Ubuntu.

    Docker containers are isolated environments. You can see it when you issue the top command in a Docker container that has been created from a Docker image.

    Besides that, they are very light-weight and flexible thanks to the dockerFile configuration.

    For example, you can create a Docker image and configure a DockerFile and tell that for example when it is running then wget 'this', apt-get 'that', run 'some shell script', setting environment variables and so on.

    In micro-services projects and architecture Docker is a very viable asset. You can achieve scalability, resiliency and elasticity with Docker, Docker swarm, Kubernetes and Docker Compose.

    Another important issue regarding Docker is Docker Hub and its community. For example, I implemented an ecosystem for monitoring kafka using Prometheus, Grafana, Prometheus-JMX-Exporter, and Docker.

    For doing that, I downloaded configured Docker containers for zookeeper, kafka, Prometheus, Grafana and jmx-collector then mounted my own configuration for some of them using YAML files, or for others, I changed some files and configuration in the Docker container and I build a whole system for monitoring kafka using multi-container Dockers on a single machine with isolation and scalability and resiliency that this architecture can be easily moved into multiple servers.

    Besides the Docker Hub site there is another site called quay.io that you can use to have your own Docker images dashboard there and pull/push to/from it. You can even import Docker images from Docker Hub to quay then running them from quay on your own machine.

    Note: Learning Docker in the first place seems complex and hard, but when you get used to it then you can not work without it.

    I remember the first days of working with Docker when I issued the wrong commands or removing my containers and all of data and configurations mistakenly.

提交回复
热议问题