You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank's for the great products Docker and Docker compose.
Currently PHP Symfony framework has next logic for loading .env files:
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
# Real environment variables win over .env files.
When using docker-compose, it loads .env file by the default, but we are able to use --env-file option in order to specify path for docker envs variables. If file missing then error provided and we even can't build containers.
Such logic leads to the situation, when we want to override some variables, we need to have a separate .env file for the docker(f.e. docker/.env) and this file should be "uncommitted file". It means, that at the same time, we need to have some .env.example file(docker/.env.example) for the docker that committed. So, after such actions, every time, after pulling new changes from the git, every developer need to check if we have some new envs inside docker/.env.example and copy new values into uncommitted file docker/.env (f.e. some of the team-member has MacOS and he need to change some env variable without committing it).
We have proposal do not have different .env files for the Symfony and docker-compose(.env + docker/.env) if we already have one in the parent folder of the project. We have proposal to ask you to add additional option for the docker-compose, like --env-file-if-exists=... and in such case we can have the same behavior for the symfony framework and docker-compose. So final docker-compose instruction inside Makefile can be like next:
Yes, it's like workaround. But we can have more difficult case, f.e. when .env.local is not exists but exists .env.dev.local or vice-versa or both files exists or exists .env -> .env.local -> .env.dev -> .env.dev.local.
In additional such workaround has dependency on Make tool (sudo apt install make) and OS type.
Maybe it will be great to have native support by the docker compose utility and option like --env-file-if-exists.
P.S. WDYT?
Hello Docker Team
Thank's for the great products Docker and Docker compose.
Currently PHP Symfony framework has next logic for loading .env files:
When using docker-compose, it loads .env file by the default, but we are able to use --env-file option in order to specify path for docker envs variables. If file missing then error provided and we even can't build containers.
Such logic leads to the situation, when we want to override some variables, we need to have a separate .env file for the docker(f.e. docker/.env) and this file should be "uncommitted file". It means, that at the same time, we need to have some .env.example file(docker/.env.example) for the docker that committed. So, after such actions, every time, after pulling new changes from the git, every developer need to check if we have some new envs inside docker/.env.example and copy new values into uncommitted file docker/.env (f.e. some of the team-member has MacOS and he need to change some env variable without committing it).
We have proposal do not have different .env files for the Symfony and docker-compose(.env + docker/.env) if we already have one in the parent folder of the project. We have proposal to ask you to add additional option for the docker-compose, like --env-file-if-exists=... and in such case we can have the same behavior for the symfony framework and docker-compose. So final docker-compose instruction inside Makefile can be like next:
docker-compose --env-file .env --env-file-if-exists .env.local --env-file-if-exists .env.dev --env-file-if-exists .env.dev.local -f docker-compose.yml build
With hope
Thanks in Advance
The text was updated successfully, but these errors were encountered: