I set-up docker credential-pass using the references:
- https://blog.marcnuri.com/how-to-initialize-docker-credential-pass
- https://github.com/docker/docker-credential-helpers
I came across a GitHub Link also:
https://github.com/docker/docker-credential-helpers/issues/102
I installed the below release:
wget https://github.com/docker/docker-credential-helpers/releases/download/v0.9.3/docker-credential-pass-v0.9.3.linux-amd64 -O docker-credential-pass
I even configured
$ nano ~/.bashrc
Then added export GPG_TTY=$(tty)
$ source ~/.bashrc
Below are version details:
$ gpg --version
gpg (GnuPG) 2.4.4
libgcrypt 1.10.3
Copyright (C) 2024 g10 Code GmbH
$ docker --version
Docker version 28.1.1, build 4eba377
$ uname -m
x86_64
hostnamectl
Operating System: Ubuntu 24.04.1 LTS
Kernel: Linux 6.8.0-60-generic
Architecture: x86-64
pass --version
v1.7.4
But when I do:
docker login
docker pull
docker logout
During the docker pull, I get the error no basic auth credentials. This behaviour is observed sometimes. After setting the credentials-helper, sometimes it works, but sometimes I get the error no basic auth credentials.
When I try to run the docker commands manually, it asks me for the passphrase. Once the passphrase is entered, and I try docker login, docker pull and docker logout, it works. But again after sometime, it gives the error.
Sometimes, after running two or three times the 3 above docker steps, when running the commands manually on the terminal, it asks for passphrase.
This behaviour is even observed when I try to run docker push.
**22:12:20** no basic auth credentials
script returned exit code 1
To note:
I was setting the credential helper on the Jenkins server in order to authenticate the Jenkins user for my pipelines on Jenkins. When I try to run multiple pipelines on Jenkins, sometimes I encounter the error
429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit.
That was the reason to authenticate and I performed the setup of credentials helper.
https://docs.docker.com/docker-hub/usage/pulls/
Also, there is another workaround, to do docker login for the jenkins user:
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: dockerHubCredentials, usernameVariable: 'DH_Username', passwordVariable: 'DH_Password']
]) {
sh "echo '${DH_Password}' | docker login --username '${DH_Username}' --password-stdin"
}
Once you perform the docker pull for instance, I added the docker logout in the Jenkinsfile.
Note: In this method, Docker stores credentials in the config.json file in a base64-encoded format.
These credentials are removed when we do docker logout.
Is this some kind of bug with the credentials helper?
I have another query:
The auths section of the config.json has the private registry, for example, "privateregistry.abcd.cs.docker.fr": {} and the "https://index.docker.io/v1/" . I added "credsStore": "pass". Is it the case that when we try to run docker pull it preferred the https:// version of the credential, and attempt to pull the image with the empty credential, and so gave the error no basic auth credentials. If yes, how can we fix this problem?