jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-72376] docker.withRegistry fails to login

Open
#712 0 comments 0 reactions 0 assignees View on GitHub
component:docker-workflow-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
527
Forks
422
Avg merge
10m
Merged PRs (30d)
1

Description

In my Jenkins pipeline I had my docker plugin configured as such:

docker.withRegistry('https://registry.hub.docker.com', 'my-docker-hub-cred') {

sh "docker load -i ${WORKSPACE}/my-image.tar"  
docker.image("my-image:latest").push()
}

 

It worked fine so far. Notice the URL I used for the `withRegistry` call (https://registry.hub.docker.com).

In order to support some multi-arch images I had to introduce some different docker commands such as `docker manifest`

So it ended up like this:

docker.withRegistry('', 'my-docker-hub-cred') 

sh "docker load -i ${WORKSPACE}/my-image-amd64.tar"
sh "docker load -i ${WORKSPACE}/my-image-arm64.tar"

docker.image("my-image:latest-amd64").push()
docker.image("my-image:latest-arm64").push()

sh "docker manifest create my-image:latest --amend my-image:latest-amd64 --amend my-image:latest-arm64"
sh "docker manifest push my-image:latest"

}


 

If you notice, I've had to remove the URL `https://registry.hub.docker.com` from the Docker plugin withRegistry method. Otherwise I get the following error every time I try to push the images:

```
22:51:16  denied: requested access to the resource is denied
22:51:16  unauthorized: authentication required
```

I tried out by using the following URLs but none of them actually worked:


---
Originally reported by afalhambra, imported from: docker.withRegistry fails to login


  • status: Open
  • priority: Major
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

In my Jenkins pipeline I had my docker plugin configured as such:



docker.withRegistry('https://registry.hub.docker.com', 'my-docker-hub-cred') {

sh "docker load -i ${WORKSPACE}/my-image.tar"  
docker.image("my-image:latest").push()
}


 

It worked fine so far. Notice the URL I used for the `withRegistry` call (https://registry.hub.docker.com).
In order to support some multi-arch images I had to introduce some different docker commands such as `docker manifest`

So it ended up like this:



docker.withRegistry('', 'my-docker-hub-cred') 

sh "docker load -i ${WORKSPACE}/my-image-amd64.tar"
sh "docker load -i ${WORKSPACE}/my-image-arm64.tar"

docker.image("my-image:latest-amd64").push()
docker.image("my-image:latest-arm64").push()

sh "docker manifest create my-image:latest --amend my-image:latest-amd64 --amend my-image:latest-arm64"
sh "docker manifest push my-image:latest"

}



 

If you notice, I've had to remove the URL `https://registry.hub.docker.com` from the Docker plugin withRegistry method. Otherwise I get the following error every time I try to push the images:



22:51:16  denied: requested access to the resource is denied

22:51:16  unauthorized: authentication required


I tried out by using the following URLs but none of them actually worked:



Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.