3

I have no problems running the test "Hello World" image.

But when I try to pass the --env-file variable as part of my docker run command I am getting docker: open .env: permission denied.

I have tried granting full permissions on my .env file but not joy still.

The command I am running is docker run --network host --env-file .env <IMAGE_ID>

Any help appreciated

adam s
  • 31
  • 1
  • 2
  • Does this answer your question? [How to fix docker: Got permission denied issue](https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue) – Abdulla Nilam Aug 09 '22 at 11:17

2 Answers2

2

Step 1: Add the current user to the docker group by executing the below command

sudo usermod -aG docker $USER

Step 2: Change the permissions of docker socket which can able to connect to the docker daemon

sudo chmod 666 /var/run/docker.sock
Ashok
  • 3,190
  • 15
  • 31
0

A clean reinstall of docker fixed the problem

adam s
  • 31
  • 1
  • 2