部署19版的docker
1. 安装依赖包
[root@localhost ~]# yum -y install yum-utils device-mapper-persistent-data lvm2
#yum-utils提供了yum-config-manager
#device mapper存储驱动程序需要device-mapper-persistent-data和lvm2
#Device Mapper是Linux2.6 内核中支持逻辑卷管理的通用设备映射机制,它为实现用于存储资源管理的块设备驱动提供了一个高度模块化的内核架构。
2. 设置阿里云镜像源
[root@localhost ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo docker-ce.repo
3. 安装Docker-CE
[root@localhost ~]# yum -y install docker-ce
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker
4. 镜像加速
[root@localhost ~]# cd /etc/docker/
[root@localhost docker]# ls
key.json
[root@localhost docker]# tee /etc/docker/daemon.json <<-'EOF'
> {
> "registry-mirrors": ["https://jih246wn.mirror.aliyuncs.com"]
> }
> EOF
{
"registry-mirrors": ["https://jih246wn.mirror.aliyuncs.com"]
}
[root@localhost docker]# ls
daemon.json key.json
#每个人都有自己的镜像加速地址
[root@localhost docker]# systemctl daemon-reload
[root@localhost docker]# systemctl restart docker
5. 网络优化
[root@localhost docker]# vim /etc/sysctl.conf
net.ipv4.ip_forward=1
[root@localhost docker]# sysctl -p
net.ipv4.ip_forward = 1
[root@localhost docker]# systemctl restart network
[root@localhost docker]# systemctl restart docker