Docker环境搭建
卸载之前的docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装必要的依赖
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
设置docker仓库
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
安装docker
sudo yum install -y docker-ce docker-ce-cli containerd.io
启动docker
sudo systemctl start docker
测试是否成功
docker images
配置阿里云镜像加速
找到自己的阿里云镜像地址
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
将整段拷贝并且运行
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["你的加速器地址"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker