CentOS 7, Systemd and Environment Variables


For a variety of reasons, my Docker container needs to use systemd. Getting that going is not a problem; a number of people posted the Dockerfile changes needed to a stock CentOS 7 image.

I would also like to pass in environment variables to my container, both with the -e flag and with docker-compose. With /usr/lib/systemd/systemd as my Docker CMD, the env vars get “lost”. If I try a wrapper script around systemd, it the env vars can be seen, but, starting systemd from a shell script - doesn’t work.

Might there be some way of passing env vars into a systemd container? Or some other way of getting the equivalent information into the container before systemd is started? I see that, with linked containers, the /etc/hosts system name - ip address mappings are there in a systemd container. So, the basic idea is possible.

Thanks for any ideas.


I’ve encounterd the same problem, and could not solve it ;-(
if you have some solution, please help :wink: riclavaz@gmail.com