jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-72376] docker.withRegistry fails to login
- 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:
- https://registry.hub.docker.com
- https://docker.io
- https://registry.hub.docker.com/v2
- https://index.docker.io
---
Originally reported by afalhambra, imported from: docker.withRegistry fails to login
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 requiredI tried out by using the following URLs but none of them actually worked:
- https://registry.hub.docker.com
- https://docker.io
- https://registry.hub.docker.com/v2
- https://index.docker.io
Contributor guide
Assessment
This issue has not been assessed yet.