Centos 7 安装 Docker

Author Avatar
青枫 2020年07月14日
  • 在其它设备中阅读本文章

设置存储库

安装 yum-utils 软件包并设置稳定的存储库

yum install -y yum-utils
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

安装 Docker Engine

1. 安装最新版本的 Docker Engine 和容器

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

2. 启动 Docker

systemctl start docker

3. 运行 hello-world 镜像来验证是否正确安装了 Docker Engine

docker run hello-world

4. 将 Docker 服务加入开机自启动

systemctl enable docker