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

Docker builds do not work with Kubernetes Pipeline plugin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • None
    • Jenkins 2.19.1
      Kubernetes-Pipeline-Plugin 0.9
      Docker-Workflow-Plugin 1.9

    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

            People

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

              Dates

                Created:
                Updated:
                Resolved: