docker / docker/cli

`docker logout` doesn't work with multiple entries with the same key

Open
#2,605 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
Docker logout doesn't work with multiple entries with the same key

Steps to reproduce the issue:

  1. Add docker config.json that looks like this:
{
  "auths": {
    "1234.some.server.docker.com": {
      "auth": "T3RoZXI6"
    }
  },
  "HttpHeaders": {
    "User-Agent": "Docker-Client/19.03.12 (linux)"
  },
  "credHelpers": {
    "1234.some.server.docker.com": "login"
  }
}
  1. Run docker logout 1234.some.server.docker.com

Describe the results you received:

Removing login credentials for 1234.some.server.docker.com

But in fact, config file wasn't changed. Also, I didn't get any error

Describe the results you expected:

Removing login credentials for 1234.some.server.docker.com

auths should be empty

{
  "auths": {},
  "HttpHeaders": {
    "User-Agent": "Docker-Client/19.03.12 (linux)"
  },
  "credHelpers": {
    "1234.some.server.docker.com": "login"
  }
}

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:45:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:44:07 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 8
  Running: 0
  Paused: 0
  Stopped: 8
 Images: 10
 Server Version: 19.03.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 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: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.3.0-53-generic
 Operating System: Ubuntu 18.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.53GiB
 Name: IF841
 ID: Z2EP:CV5L:7Y65:7ZJS:HKYJ:H2SQ:ETB2:UQ7T:I54Q:3Q2C:QCZE:EWK3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):
I have the same result on every Linux based machine with the pass credential helper (Ubuntu 18.04, AWS EC2)

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

Reproduce the issue with the provided config.json containing matching auths and credHelpers entries, then start at the docker logout command entry point. Trace how credentials are removed when both entries use the same key. Done means docker logout updates auths as expected and preserves the credHelpers entry.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
authentication, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.