How to fix the “Cannot autolaunch D-Bus without X11 $DISPLAY” error

We all hate it when things don’t work! Hopefully, this post will help you resolve this issue. This post assumes that you are trying to use a command similar to the ‘aws ecr get-login-password‘ command with the ‘docker login‘ command. If this is correct, then let’s fix the “Cannot autolaunch D-Bus without X11 $DISPLAY” error.

The error you are getting should look something like this:

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

What do these commands do?

aws ecr get-login-password – The ‘get-login-password’ command fetches and displays a password that you can use to authenticate against an AWS ECR registry. Your IAM user must have permissions to use AWS ECR. The password is valid for 12 hours. You can then pass the password to the Docker CLI login. Also, note that the get-login-password is only supported by AWS CLI version 2 or in v1.17.10 or later.

Below is an example of the output:

root@ip-172-26-8-7:~# aws ecr get-login-password --region ap-southeast-2

docker login – The ‘docker login’ command enables you to log in to the Docker registry and accepts the following options: –password, –password-stdin and –username. You use the ‘username’ option to specify the username. The ‘password’ option allows you to specify a password string. Be warned, though! Using the ‘password’ option is a bad idea, since the password will up in the shell’s history, or log-files. The ‘password-stdin’ option provides the password via STDIN and is thus more secure than the ‘password’ option.

Here is an example of the warning you will get if you use the insecure –password option:

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error saving credentials: error storing credentials - err: exit status 1, out: Cannot autolaunch D-Bus without X11 $DISPLAY

How are these command used together?

The ‘aws ecr get-login-password’ command retrieves a password from AWS and then pipes the output via STDIN to ‘docker login’.

The expected result is that Docker should say:

Login Succeeded.

And Docker should not say:

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

What is the cause?

Docker supports a wide variety of credential helpers. These include the: D-Bus Secret Service, Apple macOS keychain, Microsoft Windows Credential Manager and pass.

As per Docker:

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.

Therefore, it seems the ‘secret service’ executable has some X11 dependency.

What is the solution

The simplest solution is to install pass – the standard UNIX password manager. You do not need to remove docker-compose! Pass does have a dependency on gpg, so you will need to install two applications.

You can install pass and gpg using the following command:

Ubuntu / Debian

sudo apt-get install pass gnupg2

Fedora / RHEL

sudo yum install pass gnupg2

Alternatively –

You can try to install the Amazon ECR Docker Credential Helper. What is this exactly? Well, it is a helper for the Docker daemon that makes it easier to use  Amazon ECR. Click here to read more about it.

As a last resort, use the ‘password’ option instead of ‘password-stdin’. Avoid this if possible!


Hopefully, this helped you solve the ‘Cannot autolaunch D-Bus without X11 $DISPLAY’ error! Share or like this post if your issue is now fixed. Otherwise, let us know in the comments, and we will update this post.

About the Authors

Each member of Anto's editorial team is a Cloud expert in their own right. Anto Online takes great pride in helping fellow Cloud enthusiasts. Let us know if you have an excellent idea for the next topic!

Support the Cause

Support Anto Online and buy us a coffee. Anything is possible with coffee and code.

Buy me a coffee

One Comment on “How to fix the “Cannot autolaunch D-Bus without X11 $DISPLAY” error”

Leave a Reply

Your email address will not be published. Required fields are marked *