1、設(shè)置Docker存儲庫
- 設(shè)置后可以從存儲庫安裝和更新Docker
1笆载、安裝所需的包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
2扑馁、設(shè)置穩(wěn)定存儲庫
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
2涯呻、安裝Docker CE
- 安裝最新版Docker
sudo yum install docker-ce docker-ce-cli containerd.io
3、使用阿里云Docker鏡像加速
-
獲取加速器地址
阿里云加速器 - 配置本機Docker鏡像
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
4腻要、運行HelloWorld
docker run hello-world
//本地沒找到复罐,到遠程庫獲取
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:0e11c388b664df8a27a901dce21eb89f11d8292f7fca1b3e3c4321bf7897bffe
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.