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

docker.withServer cannot connect using TLS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: docker-workflow-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.190.1
      docker-workflow (Docker Pipeline) plugin v1.19 and v1.21
      Docker version 18.09.8-ce
    • Similar Issues:

      Description

      From pipeline:

      docker.withServer('tcp://example.com:2376', 'example.com-docker-tls') { 
       def newApp = docker.build "example/example:${env.BUILD_TAG}" 
      }

      Expected behaviour:

      Image will built using remote docker, using TLS for authorization.

      Actual result:

      Error on building image.

      Error message from log:

      + docker build -t example/example:jenkins-example-master-12 . 
      time="2019-10-26T10:13:52Z" level=error msg="Can't add file /var/jenkins_home/workspace/example_master/.git/objects/40/0f84be9fb843c2fe24ae52c6f7125302d1cd26 to tar: io: read/write on closed pipe" 
      time="2019-10-26T10:13:52Z" level=error msg="Can't close tar writer: io: read/write on closed pipe"
      error during connect: Post http://example.com:2376/v1.39/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=puyypvvvedonr4ky04k16b85n&shmsize=0&t=example%2Fexample%3Ajenkins-example-master-12&target=&ulimits=null&version=1: net/http: HTTP/1.x transport connection broken: write tcp 172.17.0.4:33106->127.0.0.1:2376: write: broken pipe 
      10:13:52.096362 durable_task_monitor.go:63: exit status 1

       

      As I see, some env variables doesn't added for docker (added env and docker info before building:

      + env
      JENKINS_HOME=/var/jenkins_home
      JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
      JAVA_ALPINE_VERSION=8.212.04-r0
      RUN_CHANGES_DISPLAY_URL=https://jenkins.example.com/job/example/job/master/10/display/redirect?page=changes 
      HOSTNAME=579ca0beebd8
      LD_LIBRARY_PATH=/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64
      NODE_LABELS=master
      HUDSON_URL=https://jenkins.example.com/ 
      SHLVL=1
      HOME=/var/jenkins_home
      BUILD_URL=https://jenkins.example.com/job/example/job/master/10/ 
      HUDSON_COOKIE=28bef3bc-3f23-4d1b-9504-2cfe0d7c7b43
      JENKINS_SERVER_COOKIE=durable-9f034a1532fee0cf7d249a18086844f8
      JENKINS_UC=https://updates.jenkins.io
      WORKSPACE=/var/jenkins_home/workspace/example_master 
      REF=/usr/share/jenkins/ref
      JAVA_VERSION=8u212
      NODE_NAME=master
      EXECUTOR_NUMBER=1
      JENKINS_VERSION=2.190.1
      JENKINS_INCREMENTALS_REPO_MIRROR=https://repo.jenkins-ci.org/incrementals
      BUILD_DISPLAY_NAME=#10
      HUDSON_HOME=/var/jenkins_home
      JOB_BASE_NAME=master
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
      BUILD_ID=10
      BUILD_TAG=jenkins-example-master-10 
      LANG=C.UTF-8
      JENKINS_URL=https://jenkins.example.com/ 
      JOB_URL=https://jenkins.example.com/job/example/job/master/ 
      BUILD_NUMBER=10
      JENKINS_NODE_COOKIE=b30c0594-9acb-4370-9ed9-1355d12e90e6
      RUN_DISPLAY_URL=https://jenkins.example.com/job/example/job/master/10/display/redirect 
      JENKINS_SLAVE_AGENT_PORT=50000
      HUDSON_SERVER_COOKIE=47430c4ce0b36e37
      DOCKER_HOST=tcp://example.com:2376 
      JOB_DISPLAY_URL=https://jenkins.example.com/job/example/job/master/display/redirect 
      JOB_NAME=example/master 
      COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log
      JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
      PWD=/var/jenkins_home/workspace/example_master 
      BRANCH_NAME=master
      [Pipeline] sh
      + docker info
      Error response from daemon: Client sent an HTTP request to an HTTPS server.
      09:30:18.148356 durable_task_monitor.go:63: exit status 1

      I see DOCKER_HOST env var, but not DOCKER_CERT_PATH and DOCKER_TLS.

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            drugc0de Valeriy Polischuk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: