Docker login Fails with error message "Error saving credentials: `Cannot autolaunch D-Bus without X11 $DISPLAY`"

docker info:

Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 8
Server Version: 18.09.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.21.3.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.4GiB
Name: localhost.localdomain
ID: VKLO:LITQ:ERNE:UG3M:6FU2:B4UN:TH34:ZVZU:2UBE:3IVZ:I66Y:S2FZ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

I have downloaded secretservice from this page
Releases · docker/docker-credential-helpers · GitHub

and place the docker-credential-secretservice inside /usr/bin

config.json:

{
“auths”: {},
“HttpHeaders”: {
“User-Agent”: “Docker-Client/18.09.7 (linux)”
},
“credsStore”: “secretservice”
}

Inside terminal i am running the following command
sudo docker login

asking username, password and showing the error

"Error saving credentials: error storing credentials - err: exit status 1, out: Cannot autolaunch D-Bus without X11 $DISPLAY "

1 Like

Did you ever get a resolution to this? I notice there are no responses. Having the exact same issue. This is a headless server situation.

Found the answer here:

sudo apt -V install gnupg2 pass

Fixed. If these are Docker deps, they should probably be included as such in the docker .deb packages.

The above mentioned issue is for centos/Rhel. Not ubuntu/debian.

For pass :

download https://github.com/docker/docker-credential-helpers/releases/download/v0.6.3/docker-credential-pass-v0.6.3-amd64.tar.gz
unpack it and chmod a+x docker-credential-pass and move it to /usr/bin
install gpg2 and pass from package manager ( yum install gpg2 , for pass we need to download from https://git.zx2c4.com/password-store/snapshot/password-store-1.7.3.tar.xz)
unpack it , cd password-store-1.7.3 , sudo make install
gpg2 --gen-key ( i chose default) in the output you will receive something like 4096R/ID
pass init ID
pass insert docker-credential-pass
vi .docker/config.json
{
“auths”: {},
“HttpHeaders”: {
“User-Agent”: “Docker-Client/19.03.5 (linux)”
},
“credsStore”: “pass”
}
docker login
Login suceeded

After login suceeded , check config file

{
“auths”: {
“https://index.docker.io/v1/”: {}
},
“HttpHeaders”: {
“User-Agent”: “Docker-Client/19.03.5 (linux)”
},
“credsStore”: “pass”
}

For secretservice :

if you are getting above error , please do the following and it will work

set “credsStore” : “secretservice” in config.json
export DISPLAY=:0.0
docker login
login succeeds