docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.63k stars 5.19k forks source link

Installation failure on curl command #1295

Closed ain closed 8 years ago

ain commented 9 years ago

Despite following the installation command, installation fails:

$ sudo curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
-bash: /usr/local/bin/docker-compose: Permission denied

Platform:

Mac OS X 10.10.3 Yosemite
$ curl --version
curl 7.41.0 (x86_64-apple-darwin14.1.0) libcurl/7.41.0 OpenSSL/1.0.2a zlib/1.2.8 libidn/1.29
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets 
ain commented 9 years ago

Installing manually works with:

curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-Darwin-x86_64
sudo mv docker-compose-Darwin-x86_64 /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sge-babrams commented 9 years ago

So this is a permissions issue, you are curling (with escalated privileges) and then privileges are dropped and file redirection is happening. You have quite a few options (here is just a few):

  1. chown/chgrp /usr/local/bin to your user/group
  2. do the file redirection in a single shell command so it remain elevated: sudo bash -c "curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-uname -s-uname -m> /usr/local/bin/docker-compose"
  3. use curl option to specify output file: sudo curl -o /usr/local/bin/docker-compose -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-uname -s-uname -m``
  4. use wget output file option: sudo wget -O /usr/local/bin/docker-compose -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-uname -s-uname -m``
  5. pipe curl output into an elevated tee: curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-uname -s-uname -m| sudo tee -a /usr/local/bin/docker-compose >/dev/null
ain commented 9 years ago

@sge-babrams the point of this PR was to resolve a failing curl command currently in the documentation. Whichever way that works in one go, developers need a simplistic way. My suggestion works on both, OS X and Linux in a single go.

aanand commented 9 years ago

We've already got a note in the docs about "Permission denied" errors, although it might not have been deployed when you read it:

Note: If you get a "Permission denied" error, your /usr/local/bin directory probably isn't writable and you'll need to install Compose as the superuser. Run sudo -i, then the two commands above, then exit.

dnephin commented 8 years ago

Closing this issue since it has been documented.