ubuntu16.04安装docker-compose报错及解决

环境:已经安装过docker


# ubuntu16.04 安装compose步骤

sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose


# 报错

curl: (35) gnutls_handshake() failed: Error in the pull function.

解决办法

sudo apt-get update 报错
sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev
sudo apt-get build-dep git
mkdir git-openssl && cd git-openssl
sudo apt-get source git

每一步都报错:E: You must put some ‘source‘ URIs in your sources.list

解决办法:vi /etc/apt/sources.list 复制下面内容

deb-src http://archive.ubuntu.com/ubuntu trusty main restricted #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-updates restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse #Added by software-properties
deb-src http://security.ubuntu.com/ubuntu trusty-security restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-proposed restricted main universe multiverse #Added by software-properties

执行 sudo apt-get update 正常
执行 sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev 正常
执行 sudo apt-get build-dep git 正常
执行 mkdir git-openssl && cd git-openssl 正常

执行 sudo apt-get source git

报错 W: Can‘t drop privileges for downloading as file ‘git_1.9.1-1ubuntu0.10.dsc‘ couldn‘t be accessed by user ‘_apt‘. - pkgAcquire::Run (13: Permission denied)

执行:apt install dpkg-dev

执行: sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

中间可能会报错curl: (35) gnutls_handshake() failed: Error in the pull function.,不用管,重新执行

root@ubuntu:~/git-openssl/git-openssl# sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/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 517 0 0:00:01 0:00:01 --:--:-- 517
100 8649k 100 8649k 0 0 98k 0 0:01:28 0:01:28 --:--:-- 108k

root@ubuntu:~/git-openssl/git-openssl# docker-compose -v
bash: /usr/local/bin/docker-compose: Permission denied
root@ubuntu:~/git-openssl/git-openssl# cd /usr/local/bin/
root@ubuntu:/usr/local/bin# ls
2to3 docker-compose idle3.7 pydoc3.7 python3.6-config python3.7 python3-config pyvenv-3.7
2to3-3.6 idle3 pydoc3 python3 python3.6m python3.7m pyvenv virtualenvwrapper.sh
2to3-3.7 idle3.6 pydoc3.6 python3.6 python3.6m-config python3.7m-config pyvenv-3.6
root@ubuntu:/usr/local/bin# chmod +x docker-compose # 增加执行权限
root@ubuntu:/usr/local/bin# docker-compose -v
docker-compose version 1.17.0, build ac53b73

 

ubuntu16.04安装docker-compose报错及解决

上一篇:mac git拉取失败 Failed to connect to 127.0.0.1 port 1087: Connection refused


下一篇:Linux - MHA 配置实验