5 ms·
As a workaround you could rename your .env file to something else and mount it as .env in the docker-compose volume options.
by hiccuphippo 7y ago
As a workaround you could rename your .env file to something else and mount it as .env in the docker-compose volume options.
- Ensorceled 7y agoHow does this help all the existing applications, tools, scripts etc. that use .env?
- otobrglez 7y agoIf you wanna make it work; this is sadly the only way until Docker Compose is patched. Rename .env to something else and reconfigure autoenv.
- Ensorceled 7y agoRight. Usually workarounds actually, you know, work :-P
- cavemonkey 7y agoThose applications running inside the container would see .env as the mounted file but Docker-compose would still see the original .env file in the filesystem.
- otobrglez 7y agoI'm using autoenv - https://github.com/inishchith/autoenv https://github.com/inishchith/autoenv. The workaround that I've found for this problem is to set "AUTOENV_ENV_FILENAME=.env.user" and then inside the project folder, I'm now using ".env.user" instead of just ".env". I'll use this hack until Docker guys fix Docker Compose.
- flukus 7y agoDoes this (and the one linked to: https://direnv.net/docs/development.html https://direnv.net/docs/development.html) do anything that a simple bash entry can't: function lenv { if [ -f '.env' ]; then source .env fi } function cd { builtin cd $@; lenv; }
- RandomBK 7y agoDepending on how desperately you need to fix this and how hacky you're willing to go, LD_PRELOAD could help here as well. (i.e. https://github.com/randombk/rust-ldpreload-read https://github.com/randombk/rust-ldpreload-read)