I’m running Jenkins for MacOS (using Homebrew) and Docker Desktop on Mac v4.22.0 (117440).
When I try to push docker image to the DockerHub for Python app from Jenkins pipeline, during the authorization with the DockerHub, the Keychain is automatically opened on my Mac. It says:
Could not find keychain to save item "<my DockerHub user>".
with two options: Deny
& Reset to default values
. When I choose the second option i.e. Reset to default values
it says that all my previous passwords, certificates etc. will be deleted, which I don’t want to happen. However, then I chose Deny
option and the following error appeared and my pipeline failed:
Using the existing docker config file.Removing blacklisted property: authsRemoving blacklisted property: credsStore$ docker login -u <user> -p <password> https://index.docker.io/v1/
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error saving credentials: error storing credentials - err: exit status 1, out: `The authorization was canceled by the user.`
...
ERROR: docker login failed
Finished: FAILURE
Jenkinsfile snippet for pushing docker image to the DockerHub:
pipeline {
agent none
stages {
...
stage("Push Docker Image") {
agent any
environment {
HOME = "${env.WORKSPACE}"
}
steps {
script {
docker.withRegistry('', 'dockerhub_id') {
dockerImage.push()
dockerImage.push('latest')
}
}
}
}
...
where dockerhub_id
are my DockerHub credentials on Jenkins (it’s correct for sure).
I have also tried using docker login
command with the suggested parameter from the above output --password-stdin
but the same issue happened.
Running docker login
from terminal on my Mac works fine.
Then I found this article Cannot unset Preference "Securely store Docker logins in MacOs keychain". Upgrades from previous version fail docker login if preference unset. · Issue #3774 · docker/for-mac · GitHub
I cannot even see the preference “Securely store Docker logins in MacOs keychain” on Docker Desktop app to disable it. I have also tried removing “credsStore”: “osxkeychain”
or changing it to “credsStore”: “desktop”
in ~/.docker/config.json
file and restarting Docker Desktop but nothing helped.
I appreciate any help. Thank you in advance.