1垦巴、centOS 下載安裝docker
分別執(zhí)行下面命令:
#安裝docker
sudo yum -y install docker
#啟動docker
sudo systemctl start docker
#查看版本
docker -v
#設(shè)置開機自啟
systemctl enable docker
2、可能出現(xiàn)問題
2.1 Failed to start docker.service: Unit docker.service not found
在安裝完成之后洼冻,啟動docker報此錯誤,則分別執(zhí)行下面命令:
#卸載podman
dnf remove podman
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo yum install docker-ce docker-ce-cli
#啟動docker
sudo systemctl start docker
參考centos8 安裝docker解決:Failed to start docker.service: Unit docker.service not found
2.2 權(quán)限問題
啟動docker后隅很,不是root用戶執(zhí)行docker命令時撞牢,如docker -v,若報錯Got permission denied while trying to connect to the Docker daemon socket at.......
則執(zhí)行下面命令:
sudo chmod a+rw /var/run/docker.sock