I'm trying to run
docker-compose --env-file <(cat file1.env <(echo -e "\n\n") file2.env) config
docker-compose
expects --env-file
to be a file. I need to use (concatenate) two files.
Running docker-compose --env-file file_any.env config
works well.
Running cat file1.env <(echo -e "\n\n") file2.env
separately outputs valid result.
But it somehow doesn't work with docker-compose
.
What am I doing wrong?
You don't need an additional process substitution. The outer process substitution captures the standard output of all the commands it wraps, so you aren't limited to a single cat
command.
docker-compose --env-file <( cat file1.env; printf '\n\n'; cat file2.env) config
Unfortunately, docker-compose
requires the argument to --env-file
be a real file. The value of the argument is passed directly to Environment.from_env_file
, which makes an explicit check via env_vars_from_file
:
def env_vars_from_file(filename, interpolate=True):
"""
Read in a line delimited file of environment variables.
"""
if not os.path.exists(filename):
raise EnvFileNotFound("Couldn't find env file: {}".format(filename))
elif not os.path.isfile(filename):
raise EnvFileNotFound("{} is not a file.".format(filename))
...