CentOS下安装Docker

1. 依赖工具安装
yum install -y yum-utils device-mapper-persistent-data lvm2
2. 添加源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
3. yum安装docker-ce
yum list docker-ce.x86_64 --showduplicates | sort -r
yum install -y docker-ce

systemctl enable docker && systemctl start docker

查看版本进行确认 docker version

4. 配置镜像加速

通过修改daemon配置文件/etc/docker/daemon.json来使用加速器

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://5f9e1jti.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker

你可能感兴趣的:(容器dockercentos7)