Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker 'WARNING: permission denied' on ubuntu

My ubuntu machine has suddenly started showing this warning when using docker:

WARNING: open /home/parallels/.dockercfg: permission denied

My current user is in the docker group and this was working fine. How do I fix this without just using sudo all the time?

like image 510
ConfusedNoob Avatar asked Jan 17 '15 04:01

ConfusedNoob


1 Answers

When you run a command with sudo, unless configured otherwise through the command-line options, you will be running as the system's root user. In your case, the file permissions are set as such that only the root user has read and write access to the file, forcing you to use sudo despite your user belonging to the docker group.

Try copying, pasting and running the following to remedy access to the file:

# Change working directory
cd /home/parallels && \
# Give the root user and those belonging to the `docker` group read/write access;
# revoke all permissions for everyone else
sudo chmod u=rw,g=rw,o= .dockercfg && \
# Set the ownership of the file to the `root` user and `docker` group
sudo chown root:docker .dockercfg
like image 122
Filip Dupanović Avatar answered Oct 16 '22 14:10

Filip Dupanović