docker login fails on a server with no X11 installed

前端 未结 7 2653
眼角桃花
眼角桃花 2021-01-30 20:18

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

相关标签:
7条回答
  • 2021-01-30 20:38

    What helped me on Ubuntu 18.04 was:

    1. Following the steps in @oberstet 's post and uninstalling the golang helper
    2. Performing a login after the helper uninstall
    3. Reinstalling docker via sudo apt-get install docker
    4. Logging back in via sudo docker login
    0 讨论(0)
  • 2021-01-30 20:39

    I've resolved this issue by uninstalling docker-compose which was installed from Ubuntu repo and installing docker-compose by official instruction at https://docs.docker.com/compose/install/#install-compose

    0 讨论(0)
  • 2021-01-30 20:40

    There is a much easier answer than the ones already posted, which I found in a comment on https://github.com/docker/docker-credential-helpers/issues/105.

    The solution is to rename docker-credential-secretservice out of the way e.g: mv /usr/bin/docker-credential-secretservice /usr/bin/docker-credential-secretservice.broken

    Once you do this, docker login works regardless of whether or not docker-compose is installed. No other package additions or removals are necessary.

    0 讨论(0)
  • 2021-01-30 20:43

    This works: sudo apt remove golang-docker-credential-helpers

    0 讨论(0)
  • 2021-01-30 20:50

    You can remove the offending package golang-docker-credential-helpers without removing all of docker-compose.

    The following worked for me on a server without X11 installed:

    dpkg -r --ignore-depends=golang-docker-credential-helpers golang-docker-credential-helpers
    
    

    and then

    echo 'foo' | docker login mydockerrepo.com -u dockeruser --password-stdin
    

    Source:

    bug reported in debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910823#39
    bug reported on ubuntu: https://bugs.launchpad.net/ubuntu/+source/docker-compose/+bug/1796119

    0 讨论(0)
  • 2021-01-30 20:54

    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

    0 讨论(0)
提交回复
热议问题