Docker plugin running / failing on 'docker login' command

21 views
Skip to first unread message

No-one

unread,
Sep 30, 2019, 8:15:07 PM9/30/19
to Jenkins Users
Scenario:
We have Docker ephemeral build agents running on the Linux side via the Docker Jenkins plugin and the docker declarative pipeline syntax. We want to mimic that setup on the Windows side.

Setup:
  • Docker engine installed in Windows server 2016
  • Everything locally on that host runs as expected (i.e. we can build and run docker images)
Declarative pipeline syntax
pipeline {
    agent {
        docker {
            image 'testimage'
            label 'dockerEnabledWindows'
        }
    }
    stages {
        stage('Example Build') {
            steps {
                sh 'hostname'
            }
        }
    }
}

Problem:
Despite the exact same declarative pipeline syntax working for Linux slaves the Windows slave throws the following error

Running on Windows in C:/jenkins/workspace/Ephemeral Build Agent PoC/Ephemeral Build Agent PoC v6 Docker enabled Windows slave
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withDockerRegistry
Using the existing docker config file.Removing blacklisted property: auths$ docker login -u ****** -p ******** https://index.docker.io/v1/
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password
[Pipeline] // withDockerRegistry
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: docker login failed
Finished: FAILURE

This was the error the first time so I setup an account with Docker Hub and ran the docker login command to cache the login, hoping that would work.

$ docker login -u ******* -p ******** https://index.docker.io/v1/
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

Running that same image locally on the Windows slave host does not produce any kind of login requirements.

Unclear why the withDockerRegistry and docker login pieces are even being run, they do not get run on the Linux slaves.  If the login command is indeed expected what is the correct way to set this up?
Reply all
Reply to author
Forward
0 new messages