1. 安装docker的yum源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
2. 安装指定docker版本
yum list docker-ce.x86_64 --showduplicates |sort -r
yum install -y docker-ce-19.03.15-3.el7
systemctl start docker
systemctl enable docker
3. docker常用配置
mkdir /etc/docker/
touch /etc/docker/daemon.json
cat > /etc/docker/daemon.json <<EOF
{
"bip": "10.250.0.1/24",
"default-address-pools": [
{
"base": "10.251.0.1/20",
"size": 24
}
],
"oom-score-adjust": -1000,
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "3"
},
"max-concurrent-downloads": 10,
"max-concurrent-uploads": 10,
"registry-mirrors": ["https://7bezldxe.mirror.aliyuncs.com"],
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
systemctl daemon-reload && systemctl restart docker
参考: https://rancher2.docs.rancher.cn/docs/rancher2.5/installation/requirements/installing-docker/_index
|