yum安装方法参考:https://www.cnblogs.com/yufeng218/p/8370670.html
https://www.cnblogs.com/straycats/p/8411248.html
一、配置docker yum源
[root@yzh-jkb-privatization ~]# vim /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=http://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgchek=0
二、开启路由转发功能,否则容器中的实例上不了网
[root@yzh-jkb-privatization ~]# vim /etc/sysctl.conf
net.ipv4.ip_forward = # 修改
[root@yzh-jkb-privatization ~]# sysctl -p # 使配置生效
[root@yzh-jkb-privatization ~]# cat /proc/sys/net/ipv4/ip_forward
1
或者:echo 1 > /proc/sys/net/ipv4/ip_forward
三、安装 docker-engine 软件包
[root@localhost ~]# yum install docker-engine -y
[root@localhost ~]# vim /etc/yum.conf
keepcache= # 默认0 改成1
四、修改yum.conf
[root@yzh-jkb-privatization ~]# vim /etc/yum.
keepcache= # 默认0 改为1 将下载下来的软件包保存在本地。方便以后使用
四、查看下载下来的软件包:
[root@yzh-jkb-privatization ~]# ls /var/cache/yum/x86_64/7/dockerrepo/packages/
docker-engine-17.05.0.ce-1.el7.centos.x86_64.rpm
docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch.rpm
# 这个目录存储缓存的软件包
五、安装
[root@yzh-jkb-privatization packages]# rpm -ivh docker-engine-selinux-17.05..ce-.el7.centos.noarch.rpm # 缺什么依赖安装
[root@yzh-jkb-privatization packages]# rpm -ivh docker-engine-17.05..ce-.el7.centos.x86_64.rpm
六、docker 平台基本操作:
[root@yzh-jkb-privatization packages]# systemctl start docker
[root@yzh-jkb-privatization packages]# systemctl enable docker [root@yzh-jkb-privatization packages]# docker version #查看版本
[root@yzh-jkb-privatization packages]# docker info # 查看信息 镜像和容器数 [root@yzh-jkb-privatization packages]# docker search centos