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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With