Docker Community Forums

Share and learn in the Docker community.

Docker run --env-file: No such file or directory

Hello,

we have a Ubuntu Server as Hyper-V machine.
On this we are able to run containers with the 18.06-ce Version of docker.

Now we got 4 containers from our supplier and wanted to get them started.

Problem is, they were adding a config.list environment file, which needs to be passed to the docker run command.

So when we want to run it with “–env-file config.list”, it sais
"docker: open config.list: No such file or directory".

The file exists, it has correct ACL set. I also tried typing the full path to the file - no success. And I also tried it with dots at the beginning ("./config.list" or “.config.list”), but it is still the same.
Also i tried it with the equal sign ("–env-file=./config.list"…) - again no success.

Without the --env-file parameter, the container can run but is useless without the variables.

Surely I missing something - can you help me out please?

Greetings, xola

Hi, if you use it like:

docker run -tid --env-file /full/path/to/file.list ...

I belive you’re doing it correctly, maybe the format of the file is causing this issue?
have you tried moving it to /tmp/ (or something simple) and input that? also might try and chmod it 644 or something just to be sure.

I already thought about that. It looks correct. Sorry but I cannot show you the content, because it contains confidential data. But it is in the format:
VARIABLE=VALUE
VARIABLE_TWO=VALUE_TWO

I also have re-written the file completely.

I created a new directory in root. This is where the all the 4 containers and docker data will reside.
This directory I recursively chmod’ded to 644 (to be honest, I once also tried 777 to make sure).

I noted one thing. When I am typing the docker run command and pressing the Tab-Key on the Keyboard, it should automatically complete the paths, right? So when I enter “cd /VR” and pressing the Tab, it should auto complete it to “cd /VRM”.
In my docker run command, I type “docker run -d --env-file /VR” and press the Tab Key. Nothing happens.
Whe I type “cd /VR” and press the tab key, it completes the path to “cd /VRM” correctly.
Is this a hint?

Maybe its something like apparmor or selinux protecting the folders in / ?

If i make a directory /test and put in a env file in it, and load that with --env-file, it works fine.

Have you checked the docker daemon logs?

selinux is not installed. And I disabled apparmor.
But no success.
Are you using Ubuntu Server?