Author: Liu Xuhui Raymond Reprint Please specify the source
Email:colorant at 163.com
blog:http://blog.csdn.net/colorant/
What is it
Simply put, Docker is a lightweight VM solution built on top of LXC, based on process containers (Processcontainer)
By analogy with the transport of goods in the real world, in order to solve the problem of transporting goods of various types and sizes in various transport vehicles, we invented the container
The purpose of Docker is to package applications and the running environment they depend on as standard container/image, and then publish to different platforms to run
Theoretically this concept is not new, and the various virtual machine image also plays a similar role
The biggest difference between Docker container and normal virtual machine image is that it does not contain the operating system kernel.
A normal virtual machine runs the entire operating system on a virtual hardware platform, providing a complete running environment for the application to run, while Docker loads the running application directly on the host platform. Essentially, he started a Linux Container using LXC at the bottom, isolating applications running in different Container through mechanisms such as cgroup, rights management, and quota allocations.
Each container has its own separate namespaces (i.e., resources) that include:
PID process, MNT file system, net Network, IPC, UTS host name, etc.
with the LXC What's the difference?
Basically you can think of the current Docker as a premium package for LXC, with a variety of assistive tools and standard interfaces for you to use LXC, and you can rely on LXC and various scripts to implement Docker-like features like you don't use Apt/yum or other tools to fix your own package installation , the key reason you use them is easy and easy.
In practice, you don't usually care about the details of the underlying LXC, nor do you plan to implement a non-LXC scheme for Docker in the future.
On the basis of LXC, Docker provides additional feature including: standard Unified package Deployment operation scheme, historical version control, image reuse, image sharing publishing, etc.
Container Build Scenarios
In addition to the core idea of lxc,docker, it is embodied in its operational container building scheme.
To maximize image reuse, speed up operations, reduce memory and disk footprint, the operating environment that the Docker container runtime constructs is actually composed of multiple layers with dependencies. For example, an Apache operating environment may be based on the underlying ROOTFS image, overlay the image containing various tools such as Emacs, and overlay the image containing Apache and its dependent library. The image is merged into the unified path by the Aufs file system load, exists in a read-only manner, and finally overlays a layer of writable white space used as a record of changes made to the current operating environment.
With a hierarchical image to do the foundation, ideally, different apps can be both possible to share the underlying file system, dependent tools, and so on, different instances of the same app can be shared with the vast majority of data, and then in the form of copy on write to maintain their own modified data and so on
History and ecological environment
Docker projects from the start to the present but more than a year, the momentum of development is very rapid
2013.01 as DotCloud internal project start
2013.03.27 officially released as Public project
2014.1 "TOP Open source ROOKIE of the Year" by Black DUCK for 2013 Years 10 big open source new project
Current status (2014.3)
Docker 0.8.1
10000+ GitHub stars (Top 50)
350+ Contributors
1500+ Fork
For specific applications, you can see that Baidu has successfully used Docker to support its BAE platform's PAAs services in at least October 2013
Installation Run and use
Although Docker is called build once, Runeverywhere. However, it is still limited by its engine dependencies, and the current version is specific to the system requirements:
Linux Kernel 3.8+ LXC support 64bit OS AUFS
Above requirements, take Ubuntu as an example, need 12.04 with 3.8kernel upgrade, or Ubuntu 13.04+
On the ubuntu12.04, the basic installation steps are as follows
Sudoapt-get update sudo apt-get install linux-image-generic-lts-raringlinux-headers-generic-lts-raring
Sudoapt-key adv--keyserver keyserver.ubuntu.com--recv-keys36a1d7869245c8950f966e92d8576a8ba88d21e9
Sudosh-c "echo Deb Http://get.docker.io/ubuntudocker main\ >/etc/apt/sources.list.d/docker.list"
Sudoapt-get Update
Sudoapt-get Install Lxc-docker
If you want to experience Docker's basic operational commands before installing, try this online live tutorial https://www.docker.io/gettingstarted/#h_tutorial
Common commands
Classify a list of common CLI commands
Warehouse related
Search/pull/push/login etc.
Example: Docker pull Ubuntu download from warehouse Ubuntuimage
Images Operation Related
Images/rmi/build/export/import/save/load etc.
Example: Docker images-t lists the current local image in a tree-shaped structure
Run related
Run/start/stop/restart/attach/kill etc.
Docker Run-i-T Ubuntu/bin/bash launches Ubuntu image and runs the shell interactively
Miscellaneous
Docker Diff/commit
Dockerinfo/ps/inspect/port/logs/top/history etc.
Use of specific Docker commands see http://docs.docker.io/en/latest/reference/commandline/
Problems