#1、參考地址:
官方參考地址:https://docs.docker.com/engine/install/centos/
參考博客:https://blog.csdn.net/benleng/article/details/103080644
https://www.runoob.com/docker/centos-docker-install.html
#2、安裝
yum install -y yum-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#3、配置修改
vi CentOS-Base.repo
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
vi CentOS-AppStream.repo
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
#4、清除緩存
dnf clean all
#5、安裝
yum install -y https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.13-3.2.el7.x86_64.rpm
yum install docker-ce docker-ce-cli
#6、測試
docker run hello-world
結果出現如下內容爲安裝成功:
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/