I. Compiling and installing Docker
1, upgrade the kernel to 4.3
[Root@docaker-node01 ~]# yum install-y make gcc gcc-c++ OpenSSL openssl--devel ncurses ncurses-devel BC
[Root@docaker-node01 ~]# wget http://mirrors.dwhd.org/Kernel/v4.x/linux-4.3.tar.xz
[Root@docaker-node01 ~]# tar XF linux-4.3.tar.xz-c/usr/src/
[Root@docaker-node01 ~]# cd/usr/src/linux-4.3/
[root@docaker-node01/usr/src/linux-4.3]# cp/boot/config-' uname-r '. config
[root@docaker-node01/usr/src/linux-4.3]# sh-c ' yes '] | Make Oldconfig '
# Make Menuconfig # # #自定义需要编译的选项
# scripts/kconfig/mconf Kconfig # # #自定义需要编译的选项
[root@docaker-node01/usr/src/linux-4.3]# make-j ' awk '/processor/{a++}end{print A} '/proc/cpuinfo ' BzImage
[root@docaker-node01/usr/src/linux-4.3]# make-j ' awk '/processor/{a++}end{print A} '/proc/cpuinfo ' modules
[root@docaker-node01/usr/src/linux-4.3]# make-j ' awk '/processor/{a++}end{print A} '/proc/cpuinfo ' Modules_install
[root@docaker-node01/usr/src/linux-4.3]# make Install
# Make Mrproper # # #编译出错重新编译需要做清除处理
[root@docaker-node01/usr/src/linux-4.3]# Sed-ri ' s/(default=). */\10/'/boot/grub/grub.conf
[root@docaker-node01/usr/src/linux-4.3]# reboot
[Root@docaker-node01 ~]# Uname-a
Linux docaker-node01.dwhd.org 4.3.0 #1 SMP Wed Nov 02:31:25 UTC 2015 x86_64 x86_64 x86_64
[Root@docaker-node01 ~]#
2. Close SELinux
[Root@docaker-node01 ~]# sed-ri ' s/^#? ((\s+)? SELINUX (TYPE)? *)/#\1/$a selinux=disabled\nselinuxtype=targeted '/etc/sysconfig/selinux
[Root@docaker-node01 ~]#/usr/sbin/setenforce 0
[Root@docaker-node01 ~]#
3, compile the high version git
[root@docaker-node01 ~]# yum-y Remove git
[root@docaker-node01 ~]# yum-y install zlib-devel perl-cpan gettext curl-devel expat-devel gettext-devel-Openssl-devel
[Root@docaker-node01 ~]# wget http://mirrors.dwhd.org/Git/git-2.6.3.tar.xz
[Root@docaker-node01 ~]# Tar XF git-2.6.3.tar.xz
[Root@docaker-node01 ~]# CD git-2.6.3
[Root@docaker-node01 ~/git-2.6.3]#./configure--prefix=/usr/local
[Root@docaker-node01 ~/git-2.6.3]# make-j $ (awk '/processor/{i++}end{print i} '/proc/cpuinfo) && make install &A mp;& CD ...
[Root@docaker-node01 ~]# echo "Path=/usr/local/bin:\ $PATH" >/etc/profile.d/git.sh
[Root@docaker-node01 ~]#. /etc/profile.d/git.sh
[Root@docaker-node01 ~]# which git
/usr/local/bin/git
[Root@docaker-node01 ~]# git--version
git version 2.6.3
[Root@docaker-node01 ~]#
4, detect iptables version XZ version and PS command, iptables≥1.4,xz≥4.9
[Root@docaker-node01 ~]# which PS
/bin/ps
[Root@docaker-node01 ~]# Iptables-v
Iptables v1.4.7
[Root@docaker-node01 ~]# Xz-v
XZ (XZ Utils) 4.999.9beta
Liblzma 4.999.9beta
[Root@docaker-node01 ~]#
5. Installation Cgroup
[Root@docaker-node01 ~]# yum install-y libcgroup libcgroup-devel
6. Install Go
[Root@docaker-node01 ~]# wget https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz
[Root@docaker-node01 ~]# tar XF go1.5.linux-amd64.tar.gz-c/usr/local/
[Root@docaker-node01 ~]# echo "Export Goroot=/usr/local/go
Export path=\ $PATH: \ $GOROOT/bin
Export Gopath=/home/go ">/etc/profile.d/go.sh
[Root@docaker-node01 ~]#. /etc/profile.d/go.sh
[Root@docaker-node01 ~]# which go
/usr/local/go/bin/go
[Root@docaker-node01 ~]# Go version
Go version go1.5 linux/amd64
[Root@docaker-node01 ~]#
Second, yum installation Docker on the CENTOS6, 7 system
1, CentOS6
2, CentOS7
[Root@docker-node1 ~]# Yum Clean all
[Root@docker-node1 ~]# cat >/etc/yum.repos.d/docker.repo <<-eof
[Dockerrepo]
Name=docker Repository
Baseurl=https://yum.dockerproject.org/repo/main/centos/7
Enabled=1
Gpgcheck=1
Gpgkey=https://yum.dockerproject.org/gpg
Eof
[Root@docker-node1 ~]# Yum Makecache
[Root@docker-node1 ~]# Yum install-y docker-engine
[Root@docker-node1 ~]# systemctl start Docker.service
[Root@docker-node1 ~]# Systemctl Enable Docker.service
Ln-s '/usr/lib/systemd/system/docker.service '/etc/systemd/system/multi-user.target.wants/docker.service '
[Root@docker-node1 ~]# systemctl status Docker.service
Docker.service-docker Application Container Engine
loaded:loaded (/usr/lib/systemd/system/docker.service; disabled)
Active:active (running) since six 2015-11-14 18:23:00 UTC; 27s ago
Docs:https://docs.docker.com
Main pid:1429 (Docker)
Cgroup:/system.slice/docker.service
└─1429/usr/bin/docker daemon-h fd://
November 18:22:34 Docker-node1 systemd[1]: Starting docker application Container Engine ...
November 18:22:34 docker-node1 docker[1429]: time= "2015-11-14t18:22:34.591696381z" Level=info msg= "API Listen on/var/run/ Docker.sock "
November 18:22:34 docker-node1 docker[1429]: time= "2015-11-14t18:22:34.757829859z" level=warning msg= "Usage of loopback Devices is strongly dis ... Ection. "
November 18:23:00 docker-node1 docker[1429]: time= "2015-11-14t18:23:00.180124034z" Level=info msg= "Firewalld running: True
November 18:23:00 docker-node1 docker[1429]: time= "2015-11-14t18:23:00.276031450z" Level=info msg= "Default Bridge" ( DOCKER0) is assigned with an ... Address
November 18:23:00 docker-node1 docker[1429]: time= "2015-11-14t18:23:00.414386410z" Level=info msg= "Loading containers: Start. "
November 18:23:00 docker-node1 docker[1429]: time= "2015-11-14t18:23:00.414649813z" Level=info msg= "Loading containers: Done. "
November 18:23:00 docker-node1 docker[1429]: time= "2015-11-14t18:23:00.414665485z" Level=info msg= "Daemon has completed Initialization "
November 18:23:00 docker-node1 docker[1429]: time= "2015-11-14t18:23:00.414678216z" Level=info msg= "Docker daemon" commit= 76D6BC9 Execdriver=nat ... on=1.9.0
November 18:23:00 docker-node1 systemd[1]: Started Docker application Container.
Hint:some lines were ellipsized, use-l.
[Root@docker-node1 ~]# Docker Run Hello-world
Unable to find image ' hello-world:latest ' locally
Latest:pulling from Library/hello-world
B901d36b6f2f:pull Complete
0a6ba66e537a:pull Complete
Digest:sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
status:downloaded newer image for Hello-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.
3. The Docker daemon created a new container from that image which runs the
Executable that produces the output for you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run a Ubuntu container with:
$ docker run-it Ubuntu bash
Share images, automate workflows, and a free Docker Hub account:
Https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/