jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-58875] withRegistry's DOCKER_REGISTRY_URL isn't used by newer Docker versions

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

Description

Using a Scripted Pipeline with a private registry:

node {

docker.withRegistry('https://dockerregistry.tld', 'dockerregistry-credentials') {
sh "env"
sh "docker info"
docker.build("private-project")
}
}

with this Dockerfile:


Dockerfile

FROM private-containers/private-container

RUN echo "testing" > test


which gives the following trimmed build output:

Started by user anonymous

[Pipeline] node
Running on master in /Users/simlu/src/docker-workflow-plugin/work/workspace/meow
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withDockerRegistry
$ docker login -u username -p ******** https://dockerregistry.tld
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
[Pipeline] {
[Pipeline] sh
[meow] Running shell script
+ env
[…]
DOCKER_REGISTRY_URL=https://dockerregistry.tld
DOCKER_CONFIG=/Users/simlu/src/docker-workflow-plugin/work/workspace/meow@​tmp/9db41f29-06a0-4f3e-bee1-eed0cea6d642
[…]
MAVEN_CMD_LINE_ARGS= hpi:run
[…]
[Pipeline] sh
[meow] Running shell script
+ docker info
Client:
Debug Mode: false

Server:
Containers: 19
Running: 0
Paused: 0
Stopped: 19
Images: 148
Server Version: 19.03.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.184-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: docker-desktop
ID: something
Docker Root Dir: /var/lib/docker
Debug Mode: true
File Descriptors: 29
Goroutines: 44
System Time: 2019-08-09T12:50:56.902213375Z
EventsListeners: 2
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

[Pipeline] sh
[meow] Running shell script
+ docker build -t private-project .
Sending build context to Docker daemon 7.68kB

Step 1/4 : FROM private-containers/private-container
pull access denied for private-containers/private-container, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
[Pipeline] }
[Pipeline] // withDockerRegistry
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE


doesn't use the private registry, it tries to talk to Docker Hub.

NOTE: that there is no Username: username output before the Registry: in docker info.

This works with an older Docker-CE version, e.g. 18.09.7.

Please let me know if there's anything else I can provide for this to be solved quicker.

---
Originally reported by simmel, imported from: withRegistry's DOCKER_REGISTRY_URL isn't used by newer Docker versions


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

Raw content of original issue

Using a Scripted Pipeline with a private registry:



node {

docker.withRegistry('https://dockerregistry.tld', 'dockerregistry-credentials') {
sh "env"
sh "docker info"
docker.build("private-project")
}
}


with this Dockerfile:


Dockerfile

FROM private-containers/private-container

RUN echo "testing" > test


which gives the following trimmed build output:


Started by user anonymous

[Pipeline] node
Running on master in /Users/simlu/src/docker-workflow-plugin/work/workspace/meow
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withDockerRegistry
$ docker login -u username -p ******** https://dockerregistry.tld
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
[Pipeline] {
[Pipeline] sh
[meow] Running shell script
+ env
[…]
DOCKER_REGISTRY_URL=https://dockerregistry.tld
DOCKER_CONFIG=/Users/simlu/src/docker-workflow-plugin/work/workspace/meow@tmp/9db41f29-06a0-4f3e-bee1-eed0cea6d642
[…]
MAVEN_CMD_LINE_ARGS= hpi:run
[…]
[Pipeline] sh
[meow] Running shell script
+ docker info
Client:
Debug Mode: false

Server:
Containers: 19
Running: 0
Paused: 0
Stopped: 19
Images: 148
Server Version: 19.03.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.184-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: docker-desktop
ID: something
Docker Root Dir: /var/lib/docker
Debug Mode: true
File Descriptors: 29
Goroutines: 44
System Time: 2019-08-09T12:50:56.902213375Z
EventsListeners: 2
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

[Pipeline] sh
[meow] Running shell script
+ docker build -t private-project .
Sending build context to Docker daemon 7.68kB

Step 1/4 : FROM private-containers/private-container
pull access denied for private-containers/private-container, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
[Pipeline] }
[Pipeline] // withDockerRegistry
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE



doesn't use the private registry, it tries to talk to Docker Hub.

NOTE: that there is no Username: username output before the Registry: in docker info.

This works with an older Docker-CE version, e.g. 18.09.7.

Please let me know if there's anything else I can provide for this to be solved quicker.

environment

```
$ sw_vers

ProductName: Mac OS X

ProductVersion: 10.14.6

BuildVersion: 18G87

docker-workflow-plugin$ git show --shortstat

commit 38c4a56a3bd2539c9053fb77eeca9a6716950f29 (HEAD -> master, origin/master, origin/HEAD)

Author: Devin Nusbaum <d.w.nusbaum@gmail.com>

Date: Fri Aug 2 17:32:42 2019 -0400

    [maven-release-plugin] prepare for next development iteration

 1 file changed, 3 insertions(+), 3 deletions(-)

docker-workflow-plugin$

$ docker --version

Docker version 19.03.1, build 74b1e89

$ java -version

java version "1.8.0_181"

Java(TM) SE Runtime Environment (build 1.8.0_181-b13)

Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

Started via:

docker-workflow-plugin$ mvn hpi:run
```

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.