實踐環境
Centos7.8
先決條件
已安裝Docker Engine
安裝Docker Compose
- 運作以下指令下載下傳穩定版本Docker Compose
實踐如下$ sudo curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
注意:要等待下載下傳完成,下載下傳完成後會自動退出指令# curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 633 100 633 0 0 38 0 0:00:16 0:00:16 --:--:-- 148 100 11.6M 100 11.6M 0 0 75813 0 0:02:41 0:02:41 --:--:-- 61868
- 給下載下傳的二進制檔案增加可執行權限
$ sudo chmod +x /usr/local/bin/docker-compose
- 為友善執行指令,增加軟連接配接
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
- 測試驗證是否安裝成功
如果軟體包沒下載下傳完全,執行上述指令時可能報錯:$ docker-compose --version docker-compose version 1.28.5, build c4eb3a1f
[110532] Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg
解除安裝Docker Compose
$ sudo rm /usr/local/bin/docker-compose
$ pip uninstall docker-compose