Centos安装Docker

卸载原来的docker

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

安装依赖

sudo yum update -y && sudo yum install -y yum-utils device-mapper-persistent-data lvm2

添加官方yum库

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

安装docker

sudo yum install docker-ce docker-ce-cli containerd.io

查看docker版本

docker --version

开机启动

systemctl enable --now docker

配置国内源加速

vi /etc/docker/daemon.json

{
  "registry-mirrors": [
  "https://registry.docker-cn.com",
  "http://hub-mirror.c.163.com"
  ]
}

systemctl daemon-reload
systemctl restart docker

你可能感兴趣的:(Docker,docker)