Skip to main content

Control environment variables inside a Docker container


1 comment

  • Phil Clay

    This statement...

    • However, if at Node level (http/s:///computer//configure), under Node Properties, you add Environment variables, those will be added to the container.

    seems to be incorrect.

    The link points to a line of code that calls

    EnvVars envHost = computer.getEnvironment();

    However, computer.getEnvironment() does not include the environment variables added via Node Properties.

    This can be confirmed by creating a node named 'node-with-properties', and adding some environment variables via Node Properties, and running the following Jenkinsfile

    node('node-with-properties') {
        docker.image('alpine').inside() {
            sh 'env'

    You can then inspect the output of the env command, and notice that the environment variables from Node Properties are not available inside the docker container.


Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.