Docker Community Forums

Share and learn in the Docker community.

Does override occur for build time?

Is there a way to work this?

When one employs two *.yml files, one to override the other; when do the overrides occur? It would appear that they do not occur in time for the build, but sometime after. Is this correct?

I am attempting to pass an argument to the Dockerfile from the compose file. I want to set it in one file and override it in another.

I have two files:
docker-compose-production.yml. In it, I have
services:
backend:
build:
arg:
stage: “–production”
docker-compose-develop.yml In it, I have
services:
backend:
build:
arg:
stage: “”

If I call
$> docker-compose --file docker-compose-production.yml up
arg gets set to --production and passed to my Dockerfile.

BUT

If I call
$> docker-compose --file docker-compose-production.yml --file docker-compose-develop.yml up
arg still gets set to --production. I need arg to be empty.

Thanks in advance

I am answering my own post with another question(s).
It is vital that I gain some understanding about the docker-compose build process, hence my asking.
Was my question unclear? Is the answer unknown by those who read it? Is there anything else?

Thanks again