-
Bug
-
Resolution: Unresolved
-
Major
-
None
Hello,
When pulling an image using docker.withRegistry() and docker.image(), the path prefix in the registry is omitted.
def remote = 'registry-1-docker-io-remote' def registry = "https://<myserver>/${remote}/" def image = 'couchbase/server:5.5.6' node { stage("login on ${registry} and pull ${image}") { docker.withRegistry(registry, 'IZ_USER'){ mavenImage = docker.image(image) mavenImage.pull() } } }
[Pipeline] withDockerRegistry $ docker login -u swb2-izu-jvt-poc -p ******** https://<myserver>/registry-1-docker-io-remote Login Succeeded [Pipeline] { [Pipeline] isUnix [Pipeline] sh + docker pull <myserver>/couchbase/server:5.5.6 Error response from daemon: unknown: Not Found
As you can see, the path part was omitted when pulling the image. It performed docker pull <myserver>/couchbase/server:5.5.6 instead of docker pull <myserver>/registry-1-docker-io-remote/couchbase/server:5.5.6
I tried with and without the final /, and with a declarative pipeline too. The result was the same.
pipeline { agent none stages { stage('login and pull') { agent { docker { image 'maven:3.6-jdk-8-slim' registryUrl 'https://<myserver>/registry-1-docker-io-remote' registryCredentialsId 'IZ_USER' } } steps { echo 'Hello, Maven' sh 'mvn --version' } } } }
$ docker login -u swb2-izu-jvt-poc -p ******** https://<myserver>/registry-1-docker-io-remote Login Succeeded [Pipeline] { [Pipeline] isUnix [Pipeline] sh + docker inspect -f . maven:3.6-jdk-8-slim Error: No such object: maven:3.6-jdk-8-slim [Pipeline] isUnix [Pipeline] sh + docker inspect -f . <myserver>/maven:3.6-jdk-8-slim Error: No such object: <myserver>/maven:3.6-jdk-8-slim [Pipeline] isUnix [Pipeline] sh + docker pull <myserver>/maven:3.6-jdk-8-slim Error response from daemon: unknown: Not Found
Pulling with sh and the Docker CLI works
def remote = 'registry-1-docker-io-remote' def registry = "<myserver>/${remote}" def image = 'couchbase/server:5.5.6' node { withCredentials([usernamePassword(credentialsId: 'IZ_USER', usernameVariable: 'IZ_USERNAME', passwordVariable: 'IZ_PASSWORD')]) { stage("cleanup local image ${image}") { try { sh "docker rmi -f ${image}" } catch(e) { echo "Caught: ${e}" } finally { echo 'System should be clean' } } stage("login on ${remote}") { sh "docker login -u ${IZ_USERNAME} -p ${IZ_PASSWORD} ${registry}" } stage("pull ${image}"){ sh "docker pull ${registry}/${image}" } } }
[Pipeline] sh + docker login -u **** -p **** <myserver>/registry-1-docker-io-remote Login Succeeded [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (pull couchbase/server:5.5.6) [Pipeline] sh + docker pull <myserver>/registry-1-docker-io-remote/couchbase/server:5.5.6 5.5.6: Pulling from registry-1-docker-io-remote/couchbase/server 2c11b7cecaa5: Pulling fs layer
Our Jenkins version is 2.263.1, and below the plugin versions linked to pipeline and docker:
docker-commons:1.17
docker-java-api:3.1.5.2
docker-plugin:1.2.1
docker-workflow:1.25
pipeline-build-step:2.13
pipeline-event-publisher:1.0.2
pipeline-graph-analysis:1.10
pipeline-input-step:2.12
pipeline-milestone-step:1.3.1
pipeline-model-api:1.7.2
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:1.7.2
pipeline-model-extensions:1.7.2
pipeline-rest-api:2.19
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.7.2
pipeline-unbreakable-build:2.0.4
pipeline-stage-view:2.19
pipeline-utility-steps:2.6.1
Thanks,