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

Docker builds do not work with Kubernetes Pipeline plugin

    XMLWordPrintable

Details

    Description

      I have setup a Kubernetes Pipeline (see below) which is working fine, as long as I do use shell-scripts to generate the Docker-Image. As soon as I try to use the docker-Workflow plugin, the script comes back, with an exception in a (not defined by myself) dockerFingerprintFrom-step. This step does not seem to be able to find the generated docker-image anymore. Therefor I do assume, that this step is then not run in the container, where I build the image.

      Any help is appreciated.

      podTemplate(label: 'docker-mysql', containers: [
          containerTemplate(name: 'docker', image: 'docker:1.12.3-dind', ttyEnabled: true, command: 'cat', privileged: true, instanceCap: 1),
          containerTemplate(name: 'jnlp', image: 'jenkinsci/jnlp-slave:2.62-alpine', args: '${computer.jnlpmac} ${computer.name}'),
        ],
        volumes: [
              hostPathVolume(mountPath: "/var/run/docker.sock", hostPath: "/var/run/docker.sock")
        ]) {
        node() {
          stage('Preparation') { // for display purposes
            git url: 'https://github.com/repo/docker-mysql.git'
            container('docker') {
              stage('Build the docker image') {
      
              sh 'docker build -t devopskube/mysql:latest .'
              sh 'docker inspect -f {{.Id}} repo/mysql:latest'
      
              id = sh (
                    script: 'docker inspect -f {{.Id}} repo/mysql:latest',
                    returnStdout: true
                   ).trim()
              }
            }
          }
        }
      

      Attachments

        Issue Links

          Activity

            jglick Jesse Glick added a comment -

            rmwpl your exception looks unrelated, either in docker-commons or docker-workflow. Best to file it separately with complete steps to reproduce from scratch and just link it to this issue.

            jglick Jesse Glick added a comment - rmwpl your exception looks unrelated, either in docker-commons or docker-workflow . Best to file it separately with complete steps to reproduce from scratch and just link it to this issue.

            Sure jglick, filed as JENKINS-46447

            rmwpl Robert Wysocki added a comment - Sure jglick , filed as JENKINS-46447

            Just ran into this as well. Any of the command using "docker." don't seem to work. I had to revert to using "sh".

            mmacfadden Michael MacFadden added a comment - Just ran into this as well. Any of the command using "docker." don't seem to work. I had to revert to using "sh".
            csanchez Carlos Sanchez added a comment - This may be fixed with JENKINS-50392 https://github.com/jenkinsci/kubernetes-plugin/pull/300

            Can't reproduce with recent version.

            vlatombe Vincent Latombe added a comment - Can't reproduce with recent version.

            People

              iocanel Ioannis Canellos
              triplem Markus May
              Votes:
              6 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: