Docker安装
1.卸载之前的docker
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 \
device-mapper-persistent-data \
lvm2
3.设置docker repo的yum位置
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装后刷新:
yum makecache fast
4. 安装docker-ce(社区版),docker-cli
sudo yum -y install docker-ce docker-ce-cli containerd.io
5.配置阿里云镜像加速
直接复制粘贴运行
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxx(自己镜像加速连接).mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
6.启动Docker并设置docker开机启动
systemctl enable docker