Jenkins - Docker login doesn't seem to persist

19 views
Skip to first unread message

Sven Hüßner

unread,
Jul 10, 2020, 10:24:22 AM7/10/20
to Jenkins Users
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 :)

Sven Hüßner

unread,
Jul 13, 2020, 5:51:42 AM7/13/20
to Jenkins Users
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!
Reply all
Reply to author
Forward
0 new messages