注:如果已经是root用户,忽略sudo
1.卸载旧版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.安装
sudo yum install -y yum-utils
3.指定地址
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
4.安装引擎和容器
sudo yum install docker-ce docker-ce-cli containerd.io
5.启动
sudo systemctl start docker
6.验证
docker -v
7.设置开机自启
sudo systemctl enable docker
8.设置镜像加速
8.1 创建加速文件
sudo mkdir -p /etc/docker
8.2设置链接
sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors":["https://82m9ar63.mirror.aliyuncs.com"] } EOF
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://guvxa32c.mirror.aliyuncs.com"]
}
EOF
8.3.重启docker服务
sudo systemct1 daemon-reload
sudo systemctl restart docker
标签:daemon,sudo,ce,systemctl,yum,docker,安装 From: https://www.cnblogs.com/jiangchunbei/p/16616892.html