Take the following simplified example:
services:
app:
image: alpine
env_file: config.env
entrypoint:
- /bin/sh
- -c
- 'echo "Var is: $$MY_VAR"'
I have config.env
locally with my local dev settings, and a config.env
on the server with production settings.
When I use docker-compose -H user@example.com up --build -d
, it uses my local config.env instead of the one on the server. I'd rather not store environment-specific configuration in my repository, however the methods recommended in the docker documentation all involve making separate .yml
files or .env
files on the same machine on which you're using docker-compose
.
So, my question is, how can I store configuration on my server, and use docker-compose
on my dev machine to deploy? Or am I better off just uploading the repo to the server and running docker-compose
there so I can use the remote env file?