2

When I run the docker-compose command I found an error on my ubuntu system. permission error

My docker-compose file

Cdocker-compose

Tell me how to solve this error and if any suggestions give.

  • 1
    why you want `root` user? – Sachith Muhandiram Sep 22 '21 at 16:29
  • 1
    Please read: [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) – Turing85 Sep 22 '21 at 16:29
  • @3760216 when I run the `docker-compose up -d` command in the terminal I face the same error. ` rajdeepsingh@officialrajdeepsingh:/media/rajdeepsingh/79215e78-8cd9-40b7-8109-9e6a38985a37/ghostLocal/dev$ docker-compose up -d ERROR: .PermissionError: [Errno 13] Permission denied: './docker-compose.yml'` – officialrajdeepsingh Sep 23 '21 at 17:19

2 Answers2

7

This permission issue is because by default docker daemon runs as root, and you are running as non-root user.

To fix the permission error, use following commands:

 sudo groupadd docker
 sudo usermod -aG docker $USER

Then logout and login again or you can simply run the following command to make the changes instantly

newgrp docker 

Learn more about it on Post-installation steps for Linux

Thanks

Exactly Rahul
  • 114
  • 10
0

chmod 777 /var/run/docker.sock

this worked for me

credit: https://feitam.es/how-to-fix-in-docker-and-docker-compose-the-error-permissionerror-errno-13-permission-denied-in-the-fastest-way-and-possibly-unorthodox/