1.卸載舊版Docker
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的詳細內容。更多資訊請關注PHP中文網其他相關文章!