I am trying to use the same docker-compose.yml and .env files for both docker-compose and swarm. The variables from the .env file should get parsed, via sed, into a config file by running a run.sh script at boot. This setup works fine when using the docker-compose up
command, but they're not getting passed when I use the docker stack deploy
command.
How can I pass the variables into the container so that the run.sh script will parse them at boot?
Actually I found the best/easiest way is to just add this argument to the docker-compose.yml file:
env_file:
- .env