Transmit Heroku environment variables to Docker instance Transmit Heroku environment variables to Docker instance heroku heroku

Transmit Heroku environment variables to Docker instance


I didn't find any documentation about it but t appears that Heroku change very recently the way it handles config vars in Docker containers: they are now replicated automatically (values from docker-compose.yml are simply ignored).


The workaround to not commit sensitive config files, would be to create a docker-compose.yml**.example** with empty fields and commit it, then add docker-compose.yml to .gitignore.

Since that's not very practical on heroku, you can use the --env docker switch to add any variable to the container's environment.

Like this: docker run --env "MY_VAR=yolo" my_image:my_tag

You could also serve a private docker-config.yml from a secure site, that heroku would have access to (that would be my preferred solution in your case).