compose icon indicating copy to clipboard operation
compose copied to clipboard

docker login fails while docker-compose is installed on Ubuntu 18.04

Open jessehallam opened this issue 8 years ago • 41 comments

Description of the issue

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

This error appears on a fresh Ubuntu Server 18.04 install. It has virtually nothing installed except docker and docker-compose. This error only occurs when docker-compose is installed.

Typing sudo apt remove docker-compose clears the error. Login now occurs using the normal docker prompt.

Context information (for bug reports)

Output of "docker-compose version"

docker-compose version 1.17.1, build unknown docker-py version: 2.5.1 CPython version: 2.7.15rc1 OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017

Output of "docker version"

Client: Version: 17.12.1-ce API version: 1.35 Go version: go1.10.1 Git commit: 7390fc6 Built: Wed Apr 18 01:23:11 2018 OS/Arch: linux/amd64

Server: Engine: Version: 17.12.1-ce API version: 1.35 (minimum version 1.12) Go version: go1.10.1 Git commit: 7390fc6 Built: Wed Feb 28 17:46:05 2018 OS/Arch: linux/amd64 Experimental: false

Output of "docker-compose config"

ubuntu@:~$ docker-compose config ERROR: Can't find a suitable configuration file in this directory or any parent. Are you in the right directory?

    Supported filenames: docker-compose.yml, docker-compose.yaml

Steps to reproduce the issue

  1. sudo apt install docker
  2. sudo apt install docker-compose
  3. docker login

Observed result

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

Expected result

The normal docker login prompt.

Stacktrace / full error message

(if applicable)

Additional information

OS version / distribution, docker-compose install method, etc.

Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-1010-aws x86_64)

This machine was built using Amazon AWS's Canonical Ubuntu 18.04 AMI. It has virtually nothing installed on it, except for docker, docker-compose and sshd.

jessehallam avatar Jun 17 '18 19:06 jessehallam

Looks like a bug with the Ubuntu package, which is not owned by us. Additionally, the version the package installs (1.17.1) is no longer supported.

Please follow the official install instructions instead: https://docs.docker.com/compose/install/

shin- avatar Jun 18 '18 17:06 shin-

adding that: following the official install instructions does not work when working on ARM platform (RPi)

uname -m
> aarch64

which can't find anything when it's apart of the cURL command to download the latest :/

any word on if/when ARM boards might be supported directly?

tuddman avatar Jun 24 '18 00:06 tuddman

I'm having the same issue woth Ubuntu18.04 server. I have tried with

  • docker-compose not present
  • docker-compose installed using the link provided by @shin-

but I keep getting Cannot autolaunch D-Bus without X11 $DISPLAY

Installed packages version:

$ docker --version Docker version 18.03.1-ce, build 9ee9f40 $ docker-compose --version docker-compose version 1.21.2, build a133471

lucafallabrino avatar Jun 28 '18 09:06 lucafallabrino

@tuddman We don't provide a build for arm architectures, but you can install the latest version using pip.

@lucafallabrino That's a completely unrelated issue. You're trying to use the secretservice credential helper on a server without X11, which isn't going to work. Use docker-credentials-pass on servers instead.

shin- avatar Jun 28 '18 16:06 shin-

I'm having the same (or a similar) issue, running docker login failing with the error message Cannot autolaunch D-Bus without X11 $DISPLAY. Having stumbled across https://github.com/docker/docker-credential-helpers/issues/60 it seems as if golang-docker-credential-helpers causes the issue here. Temporarily uninstalling docker-compose including the package above allowed me to run docker login to authenticate with my docker registry.

kiliankoe avatar Jul 03 '18 09:07 kiliankoe

hi, why is the issue closed? the workaround from @kiliankoe works but it is still a problem on a new ubuntu 18.04 installation.

kinkerl avatar Jul 24 '18 11:07 kinkerl

Closed because not a Compose issue: https://github.com/docker/compose/issues/6023#issuecomment-398136466

shin- avatar Jul 24 '18 16:07 shin-

It's very much an issue. Fresh install of 18.04, installed docker-compose through pip. Exact same issue.

mullenba avatar Aug 26 '18 01:08 mullenba

I found that if you remove the golang-docker-credential-helpers package after switching to docker-ce and not the bundled docker package in ubuntu 18.04, this problem is resolved.

prg3 avatar Aug 29 '18 18:08 prg3

Since this is a bug in the Ubuntu packaging for server it needs to be fixed there but in the meantime a work-around without having to uninstall docker-compose temporarily or having to switch to the docker repos instead you can make it use pass instead. This is what I did:

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"

After that docker login worked fine since it defaults to use pass and only tries to fallback to secretservice if it can't find it. secretservice seems to have an X11 dependency which isn't present on a basic server install.

Side effect is that you get a somewhat more secure credentials store or on your server instead of a base64 encoded json file.

chriswue avatar Sep 10 '18 05:09 chriswue

This happened to me on freshly installed Docker version 18.06.1-ce, build e68fc7a on Ubuntu 18.04 provided by Azure VM.

@prg3 solution (which is running apt-get purge docker-credential-pass) solved the issue - I can now az acr login --name <registry> successfully.

tomaszdudek7 avatar Sep 10 '18 13:09 tomaszdudek7

I added a bug report here, https://bugs.launchpad.net/ubuntu/+source/golang-github-docker-docker-credential-helpers/+bug/1794307

fredbcode avatar Sep 25 '18 14:09 fredbcode

@jessehallam can you please try this package instead?

sudo apt-get install install docker.io
calvin@calvinh-ws:~$ sudo docker --version
Docker version 17.12.1-ce, build 7390fc6

This is version we ship and support with Canonical Kubernetes and I've never had any issue logging into registries with this agent (From the kubernetes 1.11 release notes):

The validated docker versions are the same as for v1.10: 1.11.2 to 1.13.1 and 17.03.x (ref)

Also, @tuddman we do ship and support Docker on ARM as we actually support Kubernetes on ARM today. There are big differences in ARM architectures, but you might also want to try the package above. If it is missing, I might be able to help with that:

adding that: following the official install instructions does not work when working on ARM platform (RPi)

uname -m

aarch64

which can't find anything when it's apart of the cURL command to download the latest :/

any word on if/when ARM boards might be supported directly?

CalvinHartwell avatar Sep 25 '18 17:09 CalvinHartwell

@CalvinHartwell We've run into this with both the official Ubuntu docker.io package as well as the upstream Docker repo. In one case we installed docker-ce, ran into this issue, uninstalled it, installed docker.io and are still encountering this particular problem. It should be noted we do not have compose installed at all.

caiges avatar Sep 25 '18 20:09 caiges

Seems related with user profile : sudo docker login ko sudo su and docker login ko But sudo su - and docker login ok

fredbcode avatar Sep 25 '18 20:09 fredbcode

Hi, @CalvinHartwell same issue with docker.io

fredbcode avatar Sep 26 '18 09:09 fredbcode

I confirm that I'm hitting the same freshly provisioned systems where in installed docker.io and docker-compose in one shot: Linux 4.15.0-1021-aws #21-Ubuntu SMP

Does anyone have a workaround? I didn't have the package installed for the apt-get purge docker-credential-pass workaround.

afalko avatar Sep 27 '18 00:09 afalko

@afalko you can use sudo su - and docker login right after

fredbcode avatar Sep 27 '18 06:09 fredbcode

Of course this is just a workaround, use a full root access is not a good idea But for now ...

fredbcode avatar Sep 27 '18 06:09 fredbcode

Thanks @fredbcode !

I wound up automating this with the following workaround:

cat >gpg2.tmp <<EOF
     %echo Generating a basic OpenPGP key
     Key-Type: default
     Subkey-Type: default
     Name-Real: asdf asdf
     Name-Comment: asdf
     Name-Email: [email protected]
     Expire-Date: 0
     Passphrase: asdfasdf
     # Do a commit here, so that we can later print "done" :-)
     %commit
     %echo done
EOF
gpg2 --batch --generate-key gpg2.tmp
HOME=/home/docker-user pass init `gpg2 --list-secret-keys | grep uid -B 1 | head -n 1`

afalko avatar Sep 27 '18 18:09 afalko