Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42369

agent docker parameters do not honor the current environment

XMLWordPrintable

      Currently I need to use multiple docker containers which need to be linked together.
      I tried using the --link option to set the linked image. In my use-case I don't want to set a fixed name but need to use a variable for the name.

      In this case the args parameter is evaluated to "--link null:linkedimage" and the job fails.

      Or is there another way to pass dynamic parameters (from variables) to the docker args?

      pipeline {
          agent any
          environment {
              LINK_DOCKER_IMAGE = "linkedimage"
          }
          stages {
              stage ('Compose') {
                  agent {
                     docker {
                          image 'alpine'
                          args  "--link ${env.LINK_DOCKER_IMAGE}:linkedimage"
                      }
                  }
                  steps {
                          sh 'printenv'
                  }
              }
          }
      }
      

            Unassigned Unassigned
            sven_carstens_udg Sven Carstens
            Votes:
            29 Vote for this issue
            Watchers:
            31 Start watching this issue

              Created:
              Updated: