Skip to content

docker does not gracefully logout for non-default registry #204

@shhsu

Description

@shhsu

Steps to reproduce the issue:
We are developer an ACR credential helper. The issue was discovered during our test on os X.

We ran

  1. az acr login -name <our registry>
  2. az acr logout

The log out succeeded and the credentials were removed from osxkeychain. However, We do see the following output

WARNING: could not erase credentials: error erasing credentials - err: exit status 1, out: 'The specified item could not be found int the keychain'

After looking into the docker code. We realized this is not an ACR specific issue. This issue should repro on any non-default registry if osxkeychain was used in cred store .

Problem with the code:
https://github.com/docker/cli/blob/master/cli/command/registry/logout.go#L42-L53

In the case where hostnameAddress and serverAddress are the same, we would have duplicated entries in regsToTry. Assuming you can find serverAddress in the config file, Erase() will be called twice for this serverAddress. Cred stores such as file store or WinCred does not complain if you try to remove an entry that does not exist, but osxkeychain would.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions