1. 程式人生 > >docker使用 curl 命令安裝 docker-compose 安裝後報錯

docker使用 curl 命令安裝 docker-compose 安裝後報錯

使用curl命令安裝docker-compose時報錯:

curl -L "https://github.com/docker/compose/releases/download/1.17.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

[root@localhost tile38]# curl -L "https://github.com/docker/compose/releases/download/1.17.1/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   617    0   617    0     0    782      0 --:--:-- --:--:-- --:--:--   782
  0 8649k    0 34370    0     0    635      0  3:52:27  0:00:54  3:51:33     0
  0 8649k    0 34370    0     0    105      0 23:25:50  0:05:24 23:20:26     0
[root@localhost tile38]# chmod +x /usr/local/bin/docker-compose
[root@localhost tile38]# ls /usr/local/bin/docker-compose
/usr/local/bin/docker-compose
[root@localhost tile38]# docker-compose version
Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg
[root@localhost tile38]# docker-compose up -d
Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg

解決辦法:


進入下面的網址下載目前的最新版:
https://github.com/docker/compose/releases/tag/1.14.0-rc2
網頁拉到最下面,下載:
docker-compose-Linux-x86_64
然後將檔案上傳到 /usr/local/bin/ 資料夾下,然後將其重新命名為docker-compose,修改此檔案的許可權,增加可執行:chmod +x /usr/local/bin/docker-compose
然後再執行 

docker-compose version即可。

另一個方法:

 wget   https://coding.net/u/aminglinux/p/yuanke_centos7/git/blob/master/25docker/docker-compose-Linux-x86_64
 yum install -y  docker-compose