如果之前安裝過docker需要刪除之前的。
sudo dnf -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
安裝yum-utils工具:
dnf -y install yum-utils dnf-plugins-core
設置存儲庫:添加國內阿里docker鏡像源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
docker官網存儲庫
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
docker由于在國外以及國家方面的一些情況導致并沒有開放docker官網的。建議使用阿里云。
安裝docker軟件包
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
添加docker鏡像
cat >/etc/docker/daemon.json<< jingyu
{"registry-mirrors": ["https://docker.1ms.run","https://doublezonline.cloud","https://dislabaiot.xyz","https://docker.fxxk.dedyn.io","https://dockerpull.org","https://docker.unsee.tech","https://hub.rat.dev","https://docker.1panel.live","https://docker.nastool.de","https://docker.zhai.cm","https://docker.5z5f.com","https://a.ussh.net","https://docker.udayun.com","https://hub.geekery.cn"]
}
jingyu
啟動docker engine
sudo systemctl enable --now docker
通過運行映像來驗證安裝是否成功:hello-world
sudo docker run hello-world
?