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