Docker Community Forums

Share and learn in the Docker community.

EnvironmentFile compatibility with shell and systemd

(Jaraco) #1

My firm has some projects which are sometimes developed and deployed on Docker but other times deployed directly on systemd. We employ the use of environment files to supply configuration to these apps, so it would be nice if the format of the files for these apps was consistent, such that values from one deployment could be transferred to another.

What I find instead is that on Docker, values in the environment file are interpreted literally (backslashes and quotes included). In contrast, if an environment file is sourced by a shell or used by systemd, a different syntax is expected.

As a result, this file, often called by the same name ‘.env’ has different syntax in different context. This disparity makes it easy to supply an incorrect value.

In this ticket, I suggested that systemd should follow the Docker syntax, but they responded that it’s intentional to support shell syntax, and that seems reasonable to me.

And while the current environmentfile syntax in Docker is simple and elegant, the precedent for an environment file in systemd and shell in my estimation should dominate.

Of course, these two systems could continue to support incompatible syntaxes, but that would leave the developer/administrator with this awkward and fragile incompatibility.

In the aim of a more friendly experience, would the Docker project consider aligning itself with the conventions of systemd and shell for the environment file?