Skip to content

Instantly share code, notes, and snippets.

@hubgit
Last active February 4, 2019 13:27
Show Gist options
  • Select an option

  • Save hubgit/8f49f5794c604acff76b235d1aeec922 to your computer and use it in GitHub Desktop.

Select an option

Save hubgit/8f49f5794c604acff76b235d1aeec922 to your computer and use it in GitHub Desktop.
Sources of variables in docker-compose.yml, Dockerfile, and the applications they start

Used in docker-compose.yml

  • environment variables in the shell where docker-compose is run
  • values set in an .env file in the folder where docker-compose is run

Used in Dockerfile

  • build args set in docker-compose.yml (build > args, object) and imported with ARG in Dockerfile
  • values set with ARG in Dockerfile

Used in the app (environment variables in Dockerfile)

  • values set in the file linked to by env_file in docker-compose.yml
  • values set in the environment array in docker-compose.yml
  • values set with ENV in Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment