系统环境:CentOS 7.4

 

1、关闭selinux

[root@edu-mysql-02 ~]# cat /etc/selinux/config

1.png

2、检查epel源

[root@edu-mysql-02 ~]# rpm -qa |grep epel-release

2.png

3、安装docker

[root@edu-mysql-02 ~]# yum install  lxc  libcgroup  device-mapper-event-libs -y

3.png

根据系统版本默认安装

[root@edu-mysql-02 ~]# yum install docker -y

4.png

指定docker版本安装:

[root@master _src]# wget http://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-selinux-1.12.6-1.el7.centos.noarch.rpm

[root@master _src]# wget http://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-1.12.6-1.el7.centos.x86_64.rpm

[root@master _src]# wget http://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-debuginfo-1.12.6-1.el7.centos.x86_64.rpm

安装

[root@master _src]# yum localinstall -y docker-engine-selinux-1.12.6-1.el7.centos.noarch.rpm docker-engine-1.12.6-1.el7.centos.x86_64.rpm docker-engine-debuginfo-1.12.6-1.el7.centos.x86_64.rpm

5.png

4、启动并检查进程

[root@edu-mysql-02 ~]# # systemctl enable docker.service

[root@edu-mysql-02 ~]# systemctl start docker

[root@edu-mysql-02 ~]# ps -ef |grep docker

6.png6.png

5、修改容器

vim /usr/lib/systemd/system/docker.service

cgroupfs

7.png

重启加载:

# systemctl daemon-reload

# systemctl restart docker.service