[JIRA] (JENKINS-52724) Building an image with a custom registry overwrites environment variables

6 views
Skip to first unread message

krassimir_valev@yahoo.com (JIRA)

unread,
Jul 24, 2018, 10:48:01 AM7/24/18
to jenkinsc...@googlegroups.com
Krassimir Valev updated an issue
 
Jenkins / Bug JENKINS-52724
Building an image with a custom registry overwrites environment variables
Change By: Krassimir Valev
Summary: Building an image with a custom registry results in DNS errors overwrites environment variables
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

krassimir_valev@yahoo.com (JIRA)

unread,
Jul 24, 2018, 10:55:02 AM7/24/18
to jenkinsc...@googlegroups.com
Krassimir Valev updated an issue
Building We are using a Jenkinsfile-based pipeline to build an image within using a _docker private docker registry . withRegistry_ section The corporate proxy has been configured in the docker config, which uses is then passed via environment variables (HTTP(S)_PROXY). It seems that specifying a private , secured docker registry fails with overwrites the proxy settings, supplied by the docker daemon, resulting in the following error message :

{code:java}
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
[91mERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/main: DNS lookup error
WARNING: Ignoring APKINDEX.adfa7ceb.tar.gz: No such file or directory
{code}

The issue can be reproduced with the following simple Jenkinsfile (in order to test it you would need access to a private docker registry
and be behind a corporate proxy ):
 
{code:java}
node('docker') {
    stage("first") {
        sh 'echo FROM alpine > Dockerfile'
        sh 'echo RUN
printenv >> Dockerfile'
        sh 'echo RUN
apk add bash >> Dockerfile'
        
        //docker.withRegistry('https://registry.hub.docker.com') {
        docker.withRegistry('https://artifactory-url-here', 'credentials-id-here') {
            docker.build('test')
        }
    }
}
{code}

If you remove This is the output when using docker .withRegistry section altogether or use hub:

{code:java}
HOSTNAME=f85fb49b6a51
SHLVL=1
HOME=/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
{code}

And this is
the default output when using a private docker hub registry instead, the image can be build just fine. :

{code:java}
HOSTNAME=b2c35a88bf3e
SHLVL=1
HOME=/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
NO_PROXY=xxxxx
HTTPS_PROXY=xxxxxx
HTTP_PROXY=xxxxxx
{code}

o.v.nenashev@gmail.com (JIRA)

unread,
May 13, 2019, 5:52:02 PM5/13/19
to jenkinsc...@googlegroups.com
Change By: Oleg Nenashev
Status: Open Fixed but Unreleased
Resolution: Fixed
Released As: Docker Commons Plugin 1.15
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

o.v.nenashev@gmail.com (JIRA)

unread,
May 13, 2019, 5:52:02 PM5/13/19
to jenkinsc...@googlegroups.com

o.v.nenashev@gmail.com (JIRA)

unread,
May 13, 2019, 5:52:03 PM5/13/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages