I’m trying to reference 2 env files inside a docker compose because the second one is going to be shared with several other compose files and is in a different path
env_file sets the CONTAINER’S environment to what’s defined within the files specified
The environment Docker Compose interpolates variables from is not definable within the compose file itself, as the interpolation happens before the YAML is parsed
You can specify a custom .env file to interpolate from using the --env-file flag:
docker-compose is deprecated, use docker compose. (Although, it does seem like your command is aliased to the proper docker compose)
Your command was: docker compose --env-file [file] --env-file [file2].
You specified flags but you never really specified what command docker compose should actually execute
You’re currently in the /root directory - This does not seem like the right location, your compose file is not there.
It is. It explains exactly point #3 - your compose file is not in the directory you’re executing the compose command at
ip.env is not the source of the error, read the error message, there’s no .env file in the directory you’re in
Yes. There’s no way to make this permanent with pure Docker, then again, simply change your working directory instead of using such convoluted paths all the time