1. Docker的安装和配置(centos下)
1) 卸载旧版Docker:
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2) 配置yum源:
① 安装yum工具:yum install -y yum-utils
② 配置Docker的yum源:yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3)安装Docker:
yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
4) 启动和校验:
# 启动Docker
systemctl start docker
# 停止Docker
systemctl stop docker
# 重启
systemctl restart docker
# 设置开机自启
systemctl enable docker
# 执行docker ps命令,如果不报错,说明安装启动成功
docker ps
5) 配置镜像加速器:
① 获取镜像加速器::登录自己的阿里云账号,找到容器镜像服务里的镜像加速器,就可以看到加速器地址了。
② 配置加速器:根据页面里的操作文档配置docker镜像加速器。
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://olwe2ik2.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
标签:systemctl,yum,加速器,常用命令,镜像,docker,Docker From: https://www.cnblogs.com/sensenh/p/18307225