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

Allow to always pull base images for docker.build() in all pipelines

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The problem looks close to JENKINS-25690 but it is related to the default Jenkins Pipeline functionality.

      pipeline {
          agent { label 'master' }
          stages {
              stage('Build') {
                  steps {
                      script {
                          image = docker.build('myorg/myapp:latest')
                          // image = docker.build('myorg/myapp:latest', '--pull .') // how it must look like now
                      }
                  }
              }
          }
      }

       

      It would be nice to have a global option to force Docker to always pull base images before build ("--pull" argument). When you have a lot of Jenkinsfiles it is very hard to control that all of them pull base images before each build.

      Update: but with the ability to bypass the global setting for a specific line with docker.build(). There's a corner case when one image must be build FROM another one that also was built locally. In this situation "--pull" argument will break the second build because it hadn't been pushed to a registry yet.

        Attachments

          Activity

          Show
          kivagant Eugene G added a comment - Related StackOverflows: https://stackoverflow.com/questions/45057282/jenkins-docker-how-to-force-pull-base-image-before-build https://stackoverflow.com/questions/52345748/how-to-always-use-the-newest-version-of-a-docker-base-image

            People

            • Assignee:
              Unassigned
              Reporter:
              kivagant Eugene G
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: