Jenkins - Docker login doesn't seem to persist

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Jenkins - Docker login doesn't seem to persist

Sven Hüßner
Cheers guys,

I am fiddling with an issue I have described at the devops stackexchange fairly closely, I hope. I feel like I'm arriving where I should ask in this mailinglist to see if I'm on the right track.

In a nutshell: I am running a jenkins/jenkins container (more about the used tags below) as "Docker in Docker". So my Jenkins is a Docker container and my pipelines will instruct Jenkins to run more Docker containers.

Before we dive into pipelines and everything, I run into an issue with "docker login" to our Nexus. Do not worry, I don't think this will be a Nexus issue:

[root@909fb3a3d52c .docker]# docker login https://nexus:port
Username: jenkins
Password:
Login Succeeded
[root@909fb3a3d52c .docker]# pwd
/root/.docker
[root@909fb3a3d52c .docker]# cat config.json
{
   
"auths": {
       
"https://our.nexus.internal:<endpoint>": {
           
"auth": "<CORRECT base64 hash>"
       
}
   
}

So I would assume the login succeeded, juding by both the message and the correct base64 hash in the config file.

However:
[root@909fb3a3d52c .docker]# docker pull https://nexus.port/myImage:myTag
Error response from daemon: Get https://nexus:port/v2/myImage/manifests/myTag: no basic auth credentials

This will also be the result of any pipeline execution of course:

+ docker pull https://our.nexus.internal:<endpoint>/myImage:myTag

Error response from daemon: Get Error response from daemon: Get https://our.nexus.internal:<endpoint>/v2/myImage/manifests/myTag: no basic auth credentials

script returned
exit code 1

The curious thing:
If I run a "docker-compose up" with a compose file using the same image it pulls fine. If I use the debian based jenkins/jenkins:latest instead of jenkins/jenkins:lts-centos7 it pulls fine as well.

Pls go ahead and check the details on those two on the devops stackexchange question: https://devops.stackexchange.com/questions/11981/jenkins-docker-login-doesnt-seem-to-persist-docker-pull-wont-work-but-docke

So I am assuming something about the lts-centos7 image tag?

Maybe you guys can shine some additional light, I am uncertain where to look further, but strongly willing to investigate :)

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3ca19a18-3bde-4e9c-bc7d-6d352b49bc88o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins - Docker login doesn't seem to persist

Sven Hüßner
I was able to produce a correct behaviour starting from centos:centos7 base image and installing Docker only (no Jenkins yet) via the steps provided in the official Docker docu:

Seen here:
[root@d8d441ae6a7a /]# history
   
2  yum remove docker                   docker-client                   docker-client-latest                   docker-common                   docker-latest                   docker-latest-logrotate                   docker-logrotate                   docker-engine
   
3  yum install -y yum-utils
   
4  yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
   
5  yum install docker-ce docker-ce-cli containerd.io
   
6  systemctl start docker
   
7  docker ps
   
8  docker run hello-world
   
9  docker login https://nexus:port
   
10  docker login https://nexus:port
   
11  docker pull nexus:port/company/image:tag


# docker pull nexus:port/company/image:tag
...
Status: Downloaded newer image for nexus:port/company/image:tag

While I still have the faulty behaviour when I install docker via "yum install -y docker". So it's pretty clear to assume that I'm not facing an issue with the Jenkins Docker images specifically but rather face centos problems with their Docker package.

I guess there is no need here for an answer. I will go on to talk to the centos people.

Cheers and thanks for your consideration everyone!


Am Freitag, 10. Juli 2020 16:24:22 UTC+2 schrieb Sven Hüßner:
Cheers guys,

I am fiddling with an issue I have described at the devops stackexchange fairly closely, I hope. I feel like I'm arriving where I should ask in this mailinglist to see if I'm on the right track.

In a nutshell: I am running a jenkins/jenkins container (more about the used tags below) as "Docker in Docker". So my Jenkins is a Docker container and my pipelines will instruct Jenkins to run more Docker containers.

Before we dive into pipelines and everything, I run into an issue with "docker login" to our Nexus. Do not worry, I don't think this will be a Nexus issue:

[root@909fb3a3d52c .docker]# docker login https://nexus:port
Username: jenkins
Password:
Login Succeeded
[root@909fb3a3d52c .docker]# pwd
/root/.docker
[root@909fb3a3d52c .docker]# cat config.json
{
   
"auths": {
       
"<a href="https://our.nexus.internal" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Four.nexus.internal\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrLV_7dHEvUsrq3OzaWuiS3PI5Wg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Four.nexus.internal\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrLV_7dHEvUsrq3OzaWuiS3PI5Wg&#39;;return true;">https://our.nexus.internal:<endpoint>": {
           
"auth": "<CORRECT base64 hash>"
       
}
   
}

So I would assume the login succeeded, juding by both the message and the correct base64 hash in the config file.

However:
[root@909fb3a3d52c .docker]# docker pull <a href="https://nexus.port/myImage:myTag" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fnexus.port%2FmyImage%3AmyTag\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFZpLCb-pm0XGg1qkmJqibIdkttEg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fnexus.port%2FmyImage%3AmyTag\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFZpLCb-pm0XGg1qkmJqibIdkttEg&#39;;return true;">https://nexus.port/myImage:myTag
Error response from daemon: Get https://nexus:port/v2/myImage/manifests/myTag: no basic auth credentials

This will also be the result of any pipeline execution of course:

+ docker pull https://our.nexus.internal:<endpoint>/myImage:myTag

Error response from daemon: Get Error response from daemon: Get https://our.nexus.internal:<endpoint>/v2/myImage/manifests/myTag: no basic auth credentials

script returned
exit code 1

The curious thing:
If I run a "docker-compose up" with a compose file using the same image it pulls fine. If I use the debian based jenkins/jenkins:latest instead of jenkins/jenkins:lts-centos7 it pulls fine as well.

Pls go ahead and check the details on those two on the devops stackexchange question: <a href="https://devops.stackexchange.com/questions/11981/jenkins-docker-login-doesnt-seem-to-persist-docker-pull-wont-work-but-docke" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdevops.stackexchange.com%2Fquestions%2F11981%2Fjenkins-docker-login-doesnt-seem-to-persist-docker-pull-wont-work-but-docke\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsaaKPivKtFcF4LflPjiaX0Xit1Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdevops.stackexchange.com%2Fquestions%2F11981%2Fjenkins-docker-login-doesnt-seem-to-persist-docker-pull-wont-work-but-docke\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsaaKPivKtFcF4LflPjiaX0Xit1Q&#39;;return true;">https://devops.stackexchange.com/questions/11981/jenkins-docker-login-doesnt-seem-to-persist-docker-pull-wont-work-but-docke

So I am assuming something about the lts-centos7 image tag?

Maybe you guys can shine some additional light, I am uncertain where to look further, but strongly willing to investigate :)

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/40d283ef-3cee-478d-8910-49821e50bbdao%40googlegroups.com.