Docker 1.9 allows to pass arguments to a dockerfile. See link: https://docs.docker.com/engine/reference/builder/#arg
How can I pass the same arguments within dock
This feature was added in Compose 1.6.
Reference: https://docs.docker.com/compose/compose-file/#args
services: web: build: context: . args: FOO: foo