jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-60382] withDockerRegistry only allows one registry

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

Description

I have a script that requires two Docker registries (build image1, push to registry 1, build image2 that relies on image1, push to registry 2).

I am unable to authenticate with two registries at once using withDockerRegistry. withDockerRegistry only takes one registry argument and if you attempt to nest withDockerRegistry steps, only the innermost registry is authenticated with.

This doesn't work (only registry2 works):

withDockerRegistry() {

    withDockerRegistry() {
        sh `my-script.sh`
    }
}

withDockerRegistry should take an arbitrary amount of registries as arguments:

withDockerRegistry([, ]) {

sh 'my-script.sh'
}

---
Originally reported by frechetta93, imported from: withDockerRegistry only allows one registry


  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin
  • label(s): docker, docker-workflow-plugin, plugin, registry
  • resolution: Unresolved
  • votes: 2
  • watchers: 2
  • imported: 2025-12-07

Raw content of original issue

I have a script that requires two Docker registries (build image1, push to registry 1, build image2 that relies on image1, push to registry 2).

I am unable to authenticate with two registries at once using withDockerRegistry. withDockerRegistry only takes one registry argument and if you attempt to nest withDockerRegistry steps, only the innermost registry is authenticated with.

This doesn't work (only registry2 works):



withDockerRegistry(<registry1>) {

    withDockerRegistry(<registry2>) {
        sh `my-script.sh`
    }
}


withDockerRegistry should take an arbitrary amount of registries as arguments:



withDockerRegistry([<registry1>, <registry2>]) {

sh 'my-script.sh'
}

environment

```
Jenkins v2.176.3

docker-workflow plugin v1.21
```

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.