Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.11 KB

builds-strategy-docker-environment-variables.adoc

File metadata and controls

36 lines (27 loc) · 1.11 KB

Using Docker environment variables

To make environment variables available to the Docker build process and resulting image, you can add environment variables to the dockerStrategy definition of the BuildConfig.

The environment variables defined there are inserted as a single ENV Dockerfile instruction right after the FROM instruction, so that it can be referenced later on within the Dockerfile.

Procedure

The variables are defined during build and stay in the output image, therefore they will be present in any container that runs that image as well.

For example, defining a custom HTTP proxy to be used during build and runtime:

dockerStrategy:
...
  env:
    - name: "HTTP_PROXY"
      value: "http://myproxy.net:5187/"

You can also manage environment variables defined in the BuildConfig with the oc set env command.