替换 centos7 yum 源为中科大
yum -y install epel-release
sed -e 's|^metalink=|#metalink=|g' -e 's|^#baseurl=https\?://download.fedoraproject.org/pub/epel/|baseurl=https://mirrors.ustc.edu.cn/epel/|g' -e 's|^#baseurl=https\?://download.example/pub/epel/|baseurl=https://mirrors.ustc.edu.cn/epel/|g' -i.bak /etc/yum.repos.d/epel.repo
关闭 selinux
sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config && setenforce 0
docker-ce 最新版安装
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
modprobe br_netfilter
cat > docker.conf <<EOF
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_forward=1
EOF
cp docker.conf /etc/sysctl.d/docker.conf
sysctl -p /etc/sysctl.d/docker.conf
mkdir /etc/docker
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"insecure-registries": ["harbor.hongfu.com"]
}
EOF
# 选择版本安装
yum list docker-ce --showduplicates | sort -r
yum install docker-ce-18.06.3.ce-3.el7
评论区