sudo yum remove docker docker-common docker-selinux docker-engine
2.執行以下命令安裝依賴包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
3.鑑於國內網路問題,強烈建議使用國內源執行下面的命令新增 yum 軟體源
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.安裝Docker CE
sudo yum -y install docker-ce
5.設定開機啟動 Docker CE
sudo systemctl enable docker sudo systemctl start docker
6.鑑於國內網路問題,後續拉取 Docker 映象十分緩慢,強烈建議安裝 Docker 之後設定 國內映象加速
sudo vi /etc/docker/daemon.json { "registry-mirrors": ["https://registry.docker-cn.com"] }
7.重新啟動生效
sudo systemctl daemon-reload sudo systemctl restart docker
8.安裝docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose --version
以上就是安裝docker和docker-compose的詳細內容,更多請關注TW511.COM其它相關文章!