About Docker
Docker is an open-source application container engine that allows developers to package their applications and dependencies into a portable container, and then publish them to any popular Linux machine or virtualize them. Containers are completely sandbox-aware, with no interface (like IPhone apps) between them. There is little performance overhead and can be easily run in the machine and data center. Most importantly, they are not dependent on any language, framework including system.
Premise
First of all, your CentOS system must be 64-bit, regardless of the version. And the kernel version is at least 3.10 or more.
Use the following command to view your kernel version:
$ uname-R3.10.0-229.el7.x86_64
Finally, it is recommended that you update your system because the latest kernel may fix some bugs in the old version.
Installation
Install with Yum
Log in to the system with a user with sudo or root privileges.
Make sure your yum package is up to date
$ sudo yum update
Add a Yum repository
$ sudo tee/etc/yum.repos.d/docker.repo <<-' EOF ' [dockerrepo]name=Docker Repositorybaseurl= https://yum.dockerproject.org/repo/main/centos/$releasever/enabled=1gpgcheck=1 Gpgkey=https://yum.dockerproject.org/gpgeof
Installing the Docker Package
$ sudo yum install Docker-engine
$ sudo service docker start
Verify that Docker is installed successfully
$ sudo docker run hello-worldunable to find image ' Hello-world:latest ' locally latest:pulling from Hello-World a8219747be10:pull complete 91c95931e552:already exists Hello-World:latest:The image You is pulling has been verified. Important:image verification is a tech-preview feature and should not being relied on to provide security. Digest:sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7. 1cf5daeb82aab55838d status:downloaded Newer image forhello-world:latest Hello from Docker. This message shows the your installation appears to be working correctly. To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the"Hello-world"image from the Docker Hub. (assuming it is not already locally available.) 3. The Docker daemon created a new container from this image which runs the executable that produces the output yo U are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something + ambitious, you can run a Ubuntu container with:$ Docker Run-it ubuntu bash forMore examples and ideas, Visit:http:docs.docker.com/userguide/
Boot from Boot
$ sudo chkconfig docker on
Unloading
List the packages you have installed
$ Yum List installed | | grep dockerdocker-engine.x86_64 1.7.1-1.el7 @/docker-engine-1.7.1-1.el7.x86_64.rpm
To delete an installation package
$ sudo yum-y remove docker-engine.x86_64
Remove mirrors/containers, etc.
$ rum-rf/var/lib/docker
For details, please refer to: official website tutorial
Installation and uninstallation of Docker under the CentOS system