CentOS安装docker
1.卸载旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.安装必要工具
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
3.配置docker仓库
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
4.安装docker
yum install docker-ce
5.启动docker
systemctl start docker
6.设置开机启动
systemctl enable docker
7.设置阿里云镜像加速
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
8.配置镜像加速器
针对Docker客户端版本大于 1.10.0 的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://8z1gmdrv.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker