Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Question: Permission Denied on curl and save for docker compose #652

Closed
joeyhipolito opened this issue Feb 27, 2015 · 30 comments
Closed

Question: Permission Denied on curl and save for docker compose #652

joeyhipolito opened this issue Feb 27, 2015 · 30 comments

Comments

@joeyhipolito
Copy link

In the instructions for installing docker-compose, you can do :

curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

But you cannot intall it because:

zsh: permission denied: /usr/local/bin/docker-compose

I don't want to do sudo, because I wanted it to be like my previous installs and usage of docker

docker <command>

No sudo...

What is the proper way of setting it up?

@ehazlett
Copy link
Contributor

I believe you meant https://github.com/docker/compose. @aanand ?

@aanand
Copy link

aanand commented Feb 27, 2015

Most likely your /usr/local/bin directory isn't writable by you. Either chmod/chown it, or download docker-compose somewhere writable and sudo cp it in.

You won't need sudo to run it, just to install it.

@luisrudge
Copy link

I'm having this problem too and I'm kinda linux newbie :) Can someone help me?

@ehazlett
Copy link
Contributor

@luisrudge for compose or machine?

@luisrudge
Copy link

Oh, sorry! It's for compose!

@ehazlett
Copy link
Contributor

@luisrudge ok np :) Mind if I close this one?

@luisrudge
Copy link

Yes! Thanks!

@ghost
Copy link

ghost commented Jul 13, 2015

i'm facing same issue for docker machine, please redirect me to the solution @ehazlett

@ghost
Copy link

ghost commented Jul 19, 2015

@joeyhipolito @aanand kindly help

@aanand
Copy link

aanand commented Jul 20, 2015

@tarun6006 The problem/solution is likely the same:

Most likely your /usr/local/bin directory isn't writable by you. Either chmod/chown it, or download docker-machine somewhere writable and sudo cp it in.

You won't need sudo to run it, just to install it.

@zhangqinghe
Copy link

in terminate input sudo chown -R $(whoami) /usr/local/bin

@imad-bouhamidi
Copy link

Oh thanks @zhangqinghe it fixed the problem for me

@slawa85
Copy link

slawa85 commented Sep 10, 2015

I found this approach easier.

@ghost
Copy link

ghost commented Sep 12, 2015

@zhangqinghe this solves the problem. thanks.

@fernando-nog
Copy link

To me sudo -i before, solved the problem.

@tanchao90
Copy link

@zhangqinghe thanks . this solves my problem.

@nathanleclaire
Copy link
Contributor

please type
sudo chmod -Rf 777 /usr/local/bin
it's work

Please DO NOT do this. This will have far-reaching permission changes which are likely beyond the scope of what you'd actually like to accomplish.

@nathanleclaire
Copy link
Contributor

nathanleclaire commented Aug 29, 2016

sudo chown -R $(whoami) /usr/local/bin

Please DO NOT do this either (it will change the owner of every single file recursively in /usr/local/bin to the user you are currently running as). It's WAY overkill. I can't emphasize this enough.

Doing something like this is very likely to blow up in your face eventually. In /usr/local/bin on my Mac some files are owned by nathanleclaire and some are owned by root. The programs that put them there and rely on them probably expect it to stay this way. The suggested command above will totally decimate these carefully layed out file ownerships.

Instead, if needed, consider this type of operation instead. Save the file to a directory you own and then cp / mv it.

$ curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` \
    >~/docker-compose
$ chmod +x ~/docker-compose
$ sudo mv ~/docker-compose /usr/local/bin/docker-compose

Much safer with much less far-reaching consequences.

@AhmadAbdelghany
Copy link

From Docker documentation:

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 below, then exit

@PrabhuGithub
Copy link

nathanleclaire suggestion worked for me. Thanks

@agusgr
Copy link

agusgr commented Dec 14, 2016

Google brings me here....

Please, please PLEASE... use the @nathanleclaire solution

@zhaynoth
Copy link

zhaynoth commented Nov 2, 2017

What about this:
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

sudo usermod -aG docker your-user
Is this a good idea?

@amarouane-ABDELHAK
Copy link

make sure docker-compose is executable (chmod +x /usr/local/bin/docker-compose)

@binodluitel
Copy link

No need to mess with permissions on all files inside /usr/local/bin
Do not do

sudo chown -R $(whoami) /usr/local/bin

Do this instead

sudo -i
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod 755 /usr/local/bin/docker-compose
exit

@jimmylin212
Copy link

Please use @nathanleclaire 's solution, it works very well for me.

@milos-djokic
Copy link

make sure docker-compose is executable (chmod +x /usr/local/bin/docker-compose)

this worked on Ubuntu 18.04

@KingAlawaka
Copy link

I found this approach easier.

this worked for me :D

@polaroidkidd
Copy link

To me sudo -i before, solved the problem.

This (or any of the others mentioning sudo -i ) should be the accepted answer and not the just chown the entire /usr/local/bin

@mmzoo
Copy link

mmzoo commented Jan 24, 2020

For what it's worth: the permission denied: docker-compose error occurred to me after an upgrade of Docker. A minute earlier everything was still working fine, so my permissions were all in order.

After I started the (now upgraded) Docker desktop application and authorized it when asked for my administrator password, the error was gone. So Docker fixed the permissions itself.

@sriramgroot
Copy link

This code alone can solve this problem
sudo chmod +x /usr/local/bin/docker-compose

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests