安装yum-utils
yum install yum-utils -y
添加yum源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
安装docker-ce并更换清华源
yum install docker-ce docker-ce-cli containerd.io
echo '{"registry-mirrors":["http://docker.mirrors.ustc.edu.cn"],"insecure-registries":["docker.mirrors.ustc.edu.cn"]}' > /etc/docker/daemon.json
启动并设置开机自启
systemctl start docker
systemctl enable docker
运行个hello world测试
docker run hello-world