centos6.5 Installing Docker

Source: Internet
Author: User
Tags docker hub

centos6.5 Installing Docker


Anti-counterfeiting code: Eating bitter in the bitter, square for the venerable!


In today's mainstream society, Docker and Openstatick is a major mainstream direction, the following for everyone to explain the theoretical knowledge and practical operation of the real docker!

Theoretical knowledge:

I'm sure you all know what Docker is? That's not much to say here!

Docker is based on Go language development, the code is hosted on GitHub, and follows the Apache 2.0 Open source protocol.

The specialty of Docker is the application container (application Container).


Why use Docker?

1. Fast delivery of applications

2. Easier deployment and expansion

3. Higher efficiency

4. Rapid deployment also means simpler management

Common examples of Docker include:

1. Automatically package and deploy apps

2. Create a lightweight, private PaaS environment

3. Automated testing and continuous integration/deployment

4. Deploy and extend Web applications, databases, and back-end servers

What is the relationship between a warehouse and a registered server in Docker? Let's use the picture to explain!

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8A/02/wKioL1gkFGLhZTJ3AAB7i326gk8796.png-wh_500x0-wm_3 -wmp_4-s_4152761361.png "title=" warehouse and registered server diagram. png "alt=" wkiol1gkfglhztj3aab7i326gk8796.png-wh_50 "/>

To understand the internal Docker build, you need to understand the following three types of components:

Docker image-Docker images

Docker Warehouse-Docker Registeries

Docker Container-Docker containers

Docker image


A docker image is a read-only template when the Docker container runs, and mirroring can be used to create Docker containers. Each image consists of a series of layers (layers). Docker uses UnionFS (federated file system) to federate these layers into separate mirrors. UnionFS allows files and folders (called branches) in a standalone file system to be transparently overwritten to form a single coherent file system. Because of the presence of these layers, Docker is so light-weight. When you change a Docker image, such as upgrading to a new version of a program, a new layer is created. Therefore, instead of replacing the entire original image or re-establishing it (which you might do when using the virtual machine), just a new layer is added or upgraded. Now you don't have to republish the entire image, just upgrade, and the layer makes distributing Docker images simple and fast. Each Docker has a number of layers, and Docker uses union file systems to combine these different layers into an image.

Docker Warehouse

The Docker repository is used to store images, which can be understood as code warehouses in code control. Similarly, Docker repositories have public and private concepts. The public Docker warehouse name is the Docker Hub. The Docker Hub provides a large collection of mirrors for use. These images can be created on their own, or on the basis of someone else's image.

Warehouses are places where image files are centrally stored. Sometimes the warehouse and the warehouse registration server (Registry) are confused, not strictly differentiated. In fact, the warehouse registration server often holds multiple warehouses, each of which contains multiple mirrors, each with a different label (tag).



Warehouses are divided into public and private warehouses (both).

The largest public warehouse is the Docker Hub, which stores a large number of images for users to download. Domestic public warehouses, including Docker pool, can provide more stable and fast access for mainland users.

Of course, users can also create a private warehouse within the local network.

Once the user has created their own image, they can use the push command to upload it to a public or private repository so that the next time the mirror is used on another machine, it needs to pull down from the repository.

* Note: The concept of a Docker repository is similar to Git, where a registered server can be understood as a managed service such as GitHub.

Docker container

Docker uses containers to run applications, and a Docker container contains all the environments that an application needs to run. Each Docker container is created from a Docker image. Docker containers can run, start, stop, move, and delete. Each Docker container is a standalone and secure application platform.

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.

You can think of a container as a simple version of the Linux environment (including root user rights, process space, user space, and network space) and the applications running in it.

* Note: The image is read-only and the container creates a writable layer at the top level when it is started.


Docker has been using Libcontainer to replace the interaction of Lxc,libcontainer and Linux systems from version 0.9.


Docker Bottom-up technology

The 2 core technologies at the bottom of Docker are namespaces and Control groups

namespaces used to isolate individual containers

1) PID Namespace

The process of different users is separated by PID namespace, and the same PID can be used in different namespace. The parent process for all LXC processes in Docker is the Docker process, and each LXC process has a different namespace.

2) PID Namespace

With PID namespace, the PID in each namespace can be isolated from each other, but the network port is also the port that shares the host. Network isolation is achieved through NET namespace, each net namespace has a separate network devices, IP addresses, IP routing tables,/proc/net directory. So that every container network can be isolated. Docker by default uses Veth to connect the virtual NIC in container with a Docker Bridge:docker0 on host.

3) IPC namespace

Process interactions in container are also based on common inter-process interaction methods (interprocess COMMUNICATION-IPC) of Linux, including common semaphores, message queues, and shared memory. Container inter-process interaction is actually a process interaction in the same PID namespace on the host.

4) Mnt namespace

Similar to chroot, a process is placed into a specific directory for execution. MNT namespace allows different namespace processes to see different file structures so that each namespace process sees a file directory that is isolated. In container, see the file system, is a complete Linux system, have/etc,/lib, etc., through the chroot implementation.

5) UTS namespace

UTS ("UNIX time-sharing System") namespace allows each container to have a separate hostname and domain name so that it can be viewed as a separate node on the network rather than a process on the Host.

6) User namespace

Each container can have a different user and group ID, which means that the program can be executed internally within the container with the user inside the container rather than the user on the Host.

With the above 6 namespace isolation from the process, network, IPC, filesystem, UTS, and user perspective, a container can demonstrate the ability of a standalone computer, and different container are isolated from the OS level. However, the resources between the different namespace are still competing, and there is still a need for similar ulimit to manage the resources that each container can use--cgroup.

Cgroups (Control groups) implements quotas and measures on resources.

Introduction to the theory of knowledge here, let's work on how to install Docker on centos6.5:


Docker website: https://docs.docker.com

The CentOS series installation Docker,docker supports CENTOS6 and later versions.

Installing Docker in a Redhat/centos environment requires Linux kernel at least 3.8 and 64-bit systems, because Redhat and CentOS cores are 2.6, so we need to upgrade the kernel first.


Upgrade the kernel (remember to upgrade, otherwise there will be a lot of strange problems, it is recommended to install with Yum)


1. Yum installs 3.10 cores with AUFS module

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/06/wKiom1gkGsGiT_ffAAAp440vlAQ268.png-wh_500x0-wm_3 -wmp_4-s_2132061904.png "style=" Float:none; "title=" Yum installs a 3.10 kernel picture with Aufs module. png "alt=" Wkiom1gkgsgit_ Ffaaap440vlaq268.png-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/03/wKioL1gkGsKADjNVAABh8q5EcNg132.png-wh_500x0-wm_3 -wmp_4-s_727354982.png "style=" Float:none; "title=" Kernel figure 2.png "alt=" Wkiol1gkgskadjnvaabh8q5ecng132.png-wh_50 "/>


650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8A/03/wKioL1gkGzOA-9bcAABGwfB58jQ615.png-wh_500x0-wm_3 -wmp_4-s_1597463073.png "title=" Install kernel 3.png "alt=" Wkiol1gkgzoa-9bcaabgwfb58jq615.png-wh_50 "/>

2, modify the GRUB main profile/etc/grub.conf, set default=0, the first title of the content is the default startup kernel (generally the newly installed kernel in the first location), restart the system, then your kernel has been successfully upgraded.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8A/07/wKiom1gkHYuQDBogAAEOsGIZLOI531.png-wh_500x0-wm_3 -wmp_4-s_1539020589.png "style=" Float:none; "title=" file picture 4.png "alt=" wkiom1gkhyuqdbogaaeosgizloi531.png-wh_50 "/ >

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/03/wKioL1gkHYywbGXrAAEPgUqGi-Y955.png-wh_500x0-wm_3 -wmp_4-s_3715346107.png "style=" Float:none; "title=" 6.png "alt=" Wkiol1gkhyywbgxraaepguqgi-y955.png-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8A/07/wKiom1gkHYyTdQjyAAAIpLaeO5Q788.png-wh_500x0-wm_3 -wmp_4-s_2692703079.png "style=" Float:none; "title=" 7.png "alt=" Wkiom1gkhyytdqjyaaaiplaeo5q788.png-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8A/03/wKioL1gkHYyzkp5NAAAPJIZ56As356.png-wh_500x0-wm_3 -wmp_4-s_2150189583.png "style=" Float:none; "title=" 8.png "alt=" Wkiol1gkhyyzkp5naaapjiz56as356.png-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/07/wKiom1gkHY2CFP4eAABmUdeRF9U487.png-wh_500x0-wm_3 -wmp_4-s_3560236189.png "style=" Float:none; "title=" 9.png "alt=" Wkiom1gkhy2cfp4eaabmuderf9u487.png-wh_50 "/>

After the upgrade is complete, let's look at the kernel version:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8A/07/wKiom1gkIPHT0HeUAAAYKpBj6VQ392.png-wh_500x0-wm_3 -wmp_4-s_2798847436.png "title=" 10.png "alt=" Wkiom1gkipht0heuaaaykpbj6vq392.png-wh_50 "/>

To see if AUFS is supported:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8A/03/wKioL1gkIReCYF_mAAAafyXV5ss767.png-wh_500x0-wm_3 -wmp_4-s_3511546595.png "title=" 11.png "alt=" Wkiol1gkirecyf_maaaafyxv5ss767.png-wh_50 "/>

For, Centos6.5, you can install Docker using the Epel library:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8A/03/wKioL1gkIW2wHH7xAAAY9wK-DFc939.png-wh_500x0-wm_3 -wmp_4-s_2891194965.png "style=" Float:none; "title=" 12.png "alt=" Wkiol1gkiw2whh7xaaay9wk-dfc939.png-wh_50 "/>

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/8A/07/wKiom1gkIW6xu8OtAACzSPqoqQE589.png-wh_500x0-wm_3 -wmp_4-s_3509354362.png "style=" Float:none; "title=" 13.png "alt=" Wkiom1gkiw6xu8otaaczspqoqqe589.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8A/03/wKioL1gkIW_Rd90wAABFlobBS9k208.png-wh_500x0-wm_3 -wmp_4-s_2382948182.png "style=" Float:none; "title=" 14.png "alt=" Wkiol1gkiw_rd90waabflobbs9k208.png-wh_50 "/>

Below I can start the Docker service:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8A/03/wKioL1gkIj3j8FlsAAAtYWMQdFY761.png-wh_500x0-wm_3 -wmp_4-s_4197321508.png "title=" Start Docker.png "alt=" Wkiol1gkij3j8flsaaatywmqdfy761.png-wh_50 "/>

Above on the use of CentOS installation Docker, installation is complete, next time for you to share Centos7 and Ubuntu, Windows how to install docker!

Thank you!

This article from "Lu Chunning" blog, declined reprint!

centos6.5 Installing Docker

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.