docker / docker/cli

Docker Login using access token still tries to launch a login window which doesn't work without X11

Open
#4,054 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/authentication kind/bug status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

There are a few other open issues describing this problem (https://github.com/docker/cli/issues/2229 and https://github.com/docker/cli/issues/1136), but trying to run docker login on an account that has 2FA enabled will try to launch an authentication window. Of course without X11 this won't work and the error is returned:

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

However in this case I am using an access token, which should not require 2FA. Although I was able to surmise what the login process was trying to do from the error, it still wasn't very useful for a couple of reasons:

  1. 2FA windows should not be being launched when using an access token in the first place.
  2. The workaround is to install and initialise pass.

At the very least, shouldn't the error message indicate that the current authentication method cannot be used then? A bit silly of it to try and draw a UI element then just give up considering dockers main use will be in headless environments?

Reproduce
  1. docker login -u username
  2. Supply an access token for the password
Expected behavior

docker login -u user should not not launch a 2fa window when an access token is used.

docker version
Client: Docker Engine - Community
 Version:           23.0.1
 API version:       1.42
 Go version:        go1.19.5
 Git commit:        a5ee5b1
 Built:             Thu Feb  9 19:46:49 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.1
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.5
  Git commit:       bc3805a
  Built:            Thu Feb  9 19:46:49 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.18
  GitCommit:        2456e983eb9e37e47538f59ea18f2043c9a73640
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.16.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 4
  Running: 3
  Paused: 0
  Stopped: 1
 Images: 4
 Server Version: 23.0.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2456e983eb9e37e47538f59ea18f2043c9a73640
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
 Kernel Version: 5.10.0-0.deb10.19-rt-amd64
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 1.939GiB
 Name: DebCertus
 ID: KUHH:HVIB:2QS5:RON7:HQM5:S35Z:ZFZV:ISWL:NN33:A4U6:FLIH:O6F5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
Additional Info

First reproduced on Debian 10 running the distro's repo for docker.io (18.x), then upgraded to the current 23.0.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the docker login entry point and trace how access-token authentication selects credential storage, especially the credential-helper and pass paths. Reproduce the reported command in a headless Linux environment without X11. Done means access-token login no longer attempts an unusable authentication window, or reports a clear actionable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, linux
Domain
authentication, cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.