sudo apt-get update
sudo apt-get install docker.io
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce
無論使用哪種方法安裝Docker,安裝完成后需要啟動Docker服務,并將其添加到開機啟動項中:
sudo systemctl start docker
sudo systemctl enable docker