Getting Started with Docker
- Getting Started with Docker
- Docker definition
- Docker VS VM
- Docker Eco-System
- Docker Application Scenarios
- Docker Technology Architecture
- How Docker Works
- Appendix
Docker definition
Docker is a platform for developers and sysadmins to develop, ship, and run applications.
1. Not a container, the engine that manages the container
2. Not virtualization technology, is a platform for application development, migration and operation based on container technology
3. Support for installation on Linux OS, such as installation on Windows, OS X, with Linux VMS
Docker VS VM
Intuitive Experience: VM architecture is more hypervisor and guest OS than Docker architecture
Docker Eco-System
Docker Application Scenarios
Solve the problem of application development and operation:
- Missing dependency packages?
- A compilation error?
- is the operating system version number incorrect?
- How to configure?
- How is the application version number maintained?
- What about the physical machine?
Application Scenarios:
- Automated packaging and publishing of Web applications
- Automated testing and continuous integration, release
- Deploy and tune databases or other background applications in a service-oriented environment
- Build your own PAAs environment by compiling from scratch or by extending your existing OpenShift or cloud foundry platform
- Dies, Flynn
Advantage:
- Streamlined Programs : Docker allows developers to package their apps and dependencies into a portable container, and then publish to any popular Linux machine for virtualization.
- avoid the choice of phobias : If you have a choice of phobias, or a senior patient. Docker helps you pack your tangle! Docker mirrors, for example, include the runtime environment and configuration, so Docker can simplify the deployment of multiple application instances. For example, Web applications, background applications, database applications, big data applications such as Hadoop clusters, message queues, and so on can all be packaged into a single mirrored deployment.
- Cost Savings : On the one hand, the advent of the cloud computing era, so that developers do not have to pursue the effect of the high-quality hardware, Docker changed the high performance of the inevitable price of thinking. The combination of Docker and cloud makes the cloud space more fully utilized. It not only solves the problem of hardware management, but also changes the way of virtualization.
Docker Technology Architecture
Overall Architecture C
Logical Architecture
- Union FS: A file system that supports mounting different directories to the same virtual file system
- Cgroups: Implementing quotas and metrics on resources
- NAMESPACES:LXC implementation of the isolation, mainly from the kernel namespaces, wherein the PID, NET, IPC, MNT, UTS and other namespace will container process, network, message, file system, UTS and user space separated away
- Lxc:linux Container provides an operating system-level virtualization approach. Manage container with namespaces and cgroups
Docker on Linux
- Libcontainer: A package for container management in Docker, based on the Go language, which manages namespaces, Cgroups, capabilities, and file systems for container control
- Enhancements to the Systemd-nspawn:chroot command to execute commands or OS within a container
Elements
- image : Contains the file system structure and content required to start the Docker container, using layered structural components, the bottom of which is bootfs, and the part above is ROOTFS. The ROOTFS is read-only and uses the combined Mount technology to mount a read-write layer.
- warehouses : Warehouses are places where image files are centrally stored, and warehouse registration servers (Registry) tend to store multiple warehouses, each containing multiple mirrors, each with a different label (tag). At present, the largest public warehouse is the Docker Hub, storing a large number of images for users to download.
- container : A container is a running instance created from a mirror. It can be started, started, stopped, deleted. Each container is a mutually isolated, secure platform that Docker uses to run the application.
Safety
- File system-level protection: read-only
- Capability mechanism: Permission check
- Namespace mechanism: Process-level isolation, but administrators can kill processes directly
- Cgroups mechanism: "A malicious process can take a system attack by occupying all the resources of the system", denial of service attack
- Selinux:mac
Overall, Docker has a good security performance, but this is still a young technology, so there is no complete tool ecosystem to meet actual production needs.
How Docker Works
Technology Pillar
Docker improves container technology efficiency by making system functions like
- Namespaces acts as the first level of isolation. Ensure that a process is running in one container and cannot see or affect other processes outside the container.
- Cgroups is an important part of LXC and has the key function of resource accounting and limitation.
- UnionFS (file system) as a building block for a container. To support the lightweight and fast nature of Docker, it creates layers and users.
installation
Support for Linux, Windows, and OS X
Take CentOS 7 as an example:
Prerequisite: 64-bit, kernel version minimum 3.10
# yum install docker-engine# systemctl start docker# systemctl enable docker# docker version
Creating a container with a whalesay image
# docker search whalesay# docker pull docker/whalesay# docker run docker/whalesay cowsay boo
Work Flow
Components: Docker Client, Docker Daemon, Docker Registry
Docker-based PAAs projects
Dies
Deis (pronounced Day-iss) is an open source PaaS this makes it easy-to-deploy and manage applications on your own servers. Deis builds upon Docker and CoreOS to provide a lightweight PaaS with a heroku-inspired workflow.
Flynn
Flynn is an open-source PAAs platform that automates the deployment of any application to a Docker container cluster running on a large number of features and component designs referencing the traditional PAAs platform Heroku.
Appendix
Docker website
Dies official website
Flynn official website
Entry Information
Preliminary study on Flynn
Getting Started with Docker