Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker login fails on a server with no X11 installed

I am trying to deploy a docker configuration with images on a private docker registry.

Now, every time I execute docker login registry.example.com, I get the following error message:

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

The only solution I found for non-MacOS users was to run export $(dbus-launch) first, but that did not change anything.

I am running Ubuntu Server and tried with both the Ubuntu Docker package and the Docker-CE package.

How can I log in without an X11 session?

like image 606
msrd0 Avatar asked Jul 07 '18 11:07

msrd0


People also ask

Could not connect to players Cannot Autolaunch D bus without X11 $display?

The simplest solution to fix the “Cannot autolaunch D-Bus without X11 $DISPLAY” error is to install pass—the standard UNIX password manager. You do not need to remove docker-compose! However, the pass depends on gpg, so you will need to install two applications.


1 Answers

Looks like this is because it defaults to use the secretservice executable which seems to have some sort of X11 dependency for some reason. If you install and configure pass docker will use that instead which seems to solve the problem.

In a nutshell (from https://github.com/docker/compose/issues/6023)

sudo apt install gnupg2 pass  gpg2 --full-generate-key 

This generates a you a gpg2 key. After that's done you can list it with

gpg2 -k 

Copy the key id (from the line labelled [uid]) and do

pass init "whatever key id you have" 

Now docker login should work.

There are a couple of bugs logged on launchpad regarding this:

https://bugs.launchpad.net/ubuntu/+source/golang-github-docker-docker-credential-helpers/+bug/1794307

https://bugs.launchpad.net/ubuntu/+source/docker-compose/+bug/1796119

like image 194
ChrisWue Avatar answered Oct 03 '22 11:10

ChrisWue