I have a system where I'm trying to run the docker login
command, it is a headless linux system, but unfortunately only the Docker Credentials Helper docker-credential-secretservice is installed.
This means that I get the following error:
Error saving credentials: error storing credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`
It makes sense that I get this as:
By default, Docker looks for the native binary on each of the platforms, i.e. “osxkeychain” on macOS, “wincred” on windows, and “pass” on Linux. A special case is that on Linux, Docker will fall back to the “secretservice” binary if it cannot find the “pass” binary. If none of these binaries are present, it stores the credentials (i.e. password) in base64 encoding in the config files described above.
And since secretservice
helper uses a GUI credentials store it tries to open a window, which it can't on the headless system.
I've no control over the system, so I can't remove the /usr/bin/docker-credential-secretservice
file to force docker login
to fall back to the config file rather than using the secretservice
helper.
What I can do is create and list files in my user's home folder. I've tried to run the command as such:
docker --config ./docker login -u <user-name> -p <password> <repository>
I was under the impression that the login command would then create a config.json
in the ./docker (I've noticed docker login
will create the folder if it doesn't exist). This works on a system that doesn't have any helpers installed, but not on the system in question.
I've also tried to create a ~/.docker/config.json
with something like:
echo '{"credStore":""}' > ~/.docker/config.json
Hoping that docker login
would get the hint not to use any helpers for the credential store.
Is there a way for a non-admin to force docker login
to fall back to:
stores the credentials (i.e. password) in base64 encoding in the config files described above. Without deleting the credentials helper?
(as a side note, I'll of course ask to have the /usr/bin/docker-credential-secretservice
removed but, in case it's not possible or for future reference, are there any alternative solutions?)
Unfortunately, Docker (as of 18.06) first looks for the docker-credential-*
binaries, and if it finds any of them, it will automatically overwrite the "credsStore"
value in ~/.docker/config.json
.
Your only workaround would be to install docker-credential-pass
in your home directory so that Docker will use that instead of docker-credential-secretservice
. docker-credential-pass
does not require a GUI.
Steps to install docker-credential-pass
: