1

Is it possible to pass environmental variables as a file to a Dockerfile at the time of building a docker image?

I have used --build-arg as suggested here but as I have multiple arguments would prefer to use a file with all.

Also I have tried using docker run --env-file=mydata.env approach as well but I need to add these parameters during build time.

Thanks in advance.

Sathya
  • 105
  • 2
  • 15

1 Answers1

0

The only way to pass a build arg in to a build using the docker build command is with the --build-arg argument. There isn't support for specifying multiple build args from a file.

programmerq
  • 6,262
  • 25
  • 40