*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 <https://jenkins-auto/computer/Windows/> in 
C:/jenkins/workspace/Ephemeral Build Agent PoC/Ephemeral Build Agent PoC v6 
Docker enabled Windows slave[Pipeline] { 
<https://jenkins-auto/job/Ephemeral%20Build%20Agent%20PoC/job/Ephemeral%20Build%20Agent%20PoC%20v6%20Docker%20enabled%20Windows%20slave/3/console#>[Pipeline]
 withEnv 
<https://jenkins-auto/job/Ephemeral%20Build%20Agent%20PoC/job/Ephemeral%20Build%20Agent%20PoC%20v6%20Docker%20enabled%20Windows%20slave/3/console#>[Pipeline]
 { 
<https://jenkins-auto/job/Ephemeral%20Build%20Agent%20PoC/job/Ephemeral%20Build%20Agent%20PoC%20v6%20Docker%20enabled%20Windows%20slave/3/console#>[Pipeline]
 withDockerRegistry 
<https://jenkins-auto/job/Ephemeral%20Build%20Agent%20PoC/job/Ephemeral%20Build%20Agent%20PoC%20v6%20Docker%20enabled%20Windows%20slave/3/console#>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 
PipelineERROR: 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?*

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2966419c-c418-4151-bee3-76f51768fd46%40googlegroups.com.

Reply via email to