1

I'm trying to run a docker image on a Debian server. The preproduced image has been pulled from Docker Hub.

The cmd line is (stripped to the bones):

sudo docker run -d -p 8190:433 --env-file /path/to/file.env my-image

/path/to/file.env is similiar to /var/lib/myapp/data/file.env

Executing this results in an error message:

docker: open /path/to/file.env: no such file or directory

But: the file exists (ls /path/to/file.env shows the file). Tried also chown to root and chmod 777 wthout success. Tried also copying the file to /tmp and referring to this file.

Recurs1on
  • 39
  • 1
  • 5

1 Answers1

1

Let me copy comment from derpirscher here.

By any chance you installed docker via snap? If yes, it can't access any files outside of $HOME directory (see snapcraft.io/install/docker/debian)

say if you move file to

/root/snap/file.env

then run

sudo docker run -d -p 8190:433 --env-file /root/snap/file.env my-image
Jirapong
  • 24,074
  • 10
  • 54
  • 72
  • Hi @Jirapong, thx. I uninstalled Docker as snap and installed it as recommended by Docker. Now everything is working as expected. – Recurs1on Aug 01 '23 at 09:45