Unable to pass an environment variable to the Dockerfile build process #1529
-
I'm struggling with an issue where I need to pass an environment variable into the I've created a minimal example to quickly reproduce the issue at https://github.com/gavinharriss/batect-dockerfile-env-issue One workaround I attempted was to use Any pointers would be greatly appreciated. Thank you in advance as I've been banging my head against this for a few days now. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you'd like to pass an environment variable to the
There's more detailed information about build args in the Docker documentation: https://docs.docker.com/engine/reference/builder/#arg |
Beta Was this translation helpful? Give feedback.
If you'd like to pass an environment variable to the
Dockerfile
build process, there are a couple of things you need to do:Pass the environment variable as a build arg to the Dockerfile in your Batect config, for example:
Declare the build arg in your Dockerfile with
ARG
and then either create an environment variable with the value of the build arg, or use the value directly in subsequent commands:There's more detailed inf…