1.文档
https://docs.docker.com/engine/install/centos/
https://docs.docker.com/engine/install/linux-postinstall/
2.卸载旧版
yum remove -y docker \
docker-ce-cli \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine \
container*;
3.添加国内源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.安装
yum install device-mapper-persistent-data lvm2 bash-completion
#根据自己需要指定版本安装,如果不指定则安装最新版本,如,yum install docker-ce
yum install docker-ce-20.10.15
#添加普通用户可以使用docker命令
useradd dev
usermod -aG docker dev
newgrp docker
yum remove docker docker-common docker-selinux docker-engine
5.修改存储配置路径
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": [
"native.cgroupdriver=systemd"
],
"max-concurrent-downloads": 10,
"max-concurrent-uploads": 5,
"live-restore":true,
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file":"5"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
],
"registry-mirrors" : [
],
"data-root": "/data/docker"
}
EOF
6.服务管理
systemctl daemon-reload
systemctl enable --now docker
标签:engine,selinux,ce,yum,install,docker,安装
From: https://blog.51cto.com/hsuing/7612112