Docker Deployment - Errno 2

Hi Folks,

I am having some issues deploying containers to a remote host, specifically reading in a env_file.

The error message I get is:

[Errno 2] No such file or directory: "[‘/usr/local/hg/defaults.env’, ‘/var/lib/data/hg/config.env’]

But I can see the files are deployed to the remote host via Ansible template, i’ve even opened up all the permissions in frustration!

/usr/local/hg/

-rwxrwxrwx 1 root root 29 Sep 25 12:38 defaults.env

/var/lib/data/hg/

-rwxrwxrwx 1 root root 273 Sep 25 12:38 config.env

These files DO NOT exist on the control node, but I don’t think they need to as Docs state that it’s a file on target - https://docs.ansible.com/ansible/latest/collections/community/general/docker_container_module.html#parameter-env_file

This is driving me round the bend a little now, and it’s the last thing i need to finish to meet a deliverable, so close tho the finish line!

I’ve asked on ansible but nothing fruitful so far.

I am using the docker-py pip module.

Dave.

That error looks to me like it is looking for a file named “[‘/usr/local/hg/defaults.env’, ‘/var/lib/data/hg/config.env’]”.
Maybe you can only use one env file?

Hi,

That error looks to me like it is looking for a file named
"['/usr/local/hg/defaults.env', '/var/lib/data/hg/config.env']".
Maybe you can only use one env file?

that's correct. The documentation states that the option accepts a
path, and not a list of paths. (If you pass a list, that list is
converted to a string.)

Cheers,
Felix

This is EXACTLY the issue!

Thank you!

I have some shared ENV variables between the 2 containers, but not all ENVs are applicable to the 2nd container, so that’s why I tried to use 2 files.

Was trying to keep my env files DRY.

Think it’s worth a PR ?

Just updating my code…

Hi Dave,
Maybe you can combine the two files and then pass the new combined file to env_file?

Hi,

Think it's worth a PR ?

if you think this is needed, feel free to create one.

Cheers,
Felix