Docker Community Forums

Share and learn in the Docker community.

Unable to run docker commands: Permission Denied

Hi everyone!

I have been facing this problem for about a month now and unable to find any solution.

I am trying to run well-maintained docker container of an open-source organization with commands like docker-compose up but I am getting permission denied errors.

E: Opening configuration file /etc/apt/apt.conf.d/01autoremove - ifstream::ifstream (13: Permission denied)

Reinstalling docker solved my issue but every time I restart my PC (Ubuntu 20.04 LTS), I get the same error back again. Reinstalling docker every time before using it isn’t a solution I am looking for. I would be grateful if someone can help me with this. Thanks!

If you want to run docker as non-root user then you need to add it to the docker group.

Create the docker group if it does not exist
sudo groupadd docker Add your user to the docker group. sudo usermod -aG docker USER Run the following command or Logout and login again and run (that doesn't work you may need to reboot your machine first) newgrp docker
Check if docker can be run without root
$ docker run hello-world

And another direct quote of lewish95 without further explaination or anything:

Please ignore the posts of lewish95