Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-credential-pass warning when running docker logout <private registry> #174

Closed
jrpalma opened this issue Feb 18, 2020 · 3 comments
Closed

Comments

@jrpalma
Copy link

jrpalma commented Feb 18, 2020

I installed docker-credentials-pass and managed to make it work. However, there is an annoying warning when you run the command "sudo docker logout ". I did some searches and came across issue #102. I get the following warning:

WARNING: could not erase credentials: error erasing credentials - err: exit status 1, out: `exit status 1: Error: docker-credential-helpers/[CRED_FOLDER_NAME] is not in the password store.`

I also ran

sudo docker login registry
pass
Password Store
└── docker-credential-helpers [error opening dir]
sudo ls -lhrt ~/.password-store/
total 4.0K
drwx------ 3 root root 4.0K Feb 17 22:17 docker-credential-helpers

Therefore, to my surprise, this was successful:

sudo pass
Password Store
└── docker-credential-helpers
    └── cmVnaXN0cnk=
        └── docker
sudo pass rm -rf docker-credential-helpers/cmVnaXN0cnk=
removed '/home/user/.password-store/docker-credential-helpers/cmVnaXN0cnk=/docker.gpg'
removed directory '/home/user/.password-store/docker-credential-helpers/cmVnaXN0cnk=/'

This should have failed like it did with docker-credential-pass warning. I am puzzled as to why this warning is displayed by docker-credentials-pass but not when called from the terminal.

According to pass:

Password management should be simple and follow Unix philosophy. With pass, each password lives inside of a gpg encrypted file whose filename is the title of the website or resource that requires the password. These encrypted files may be organized into meaningful folder hierarchies, copied from computer to computer, and, in general, manipulated using standard command line file management utilities.

So, I changed the code which no longer shows the warning

diff --git a/pass/pass_linux.go b/pass/pass_linux.go
index 342e538..33a0482 100644
--- a/pass/pass_linux.go
+++ b/pass/pass_linux.go
@@ -97,7 +97,7 @@ func (h Pass) Delete(serverURL string) error {
        }
 
        encoded := base64.URLEncoding.EncodeToString([]byte(serverURL))
-       _, err := h.runPass("", "rm", "-rf", path.Join(PASS_FOLDER, encoded))
+       err := os.RemoveAll(path.Join(getPassDir(), PASS_FOLDER, encoded))
        return err
 }

Can we just do a remove? The pass documentation make it seem like this is ok. I understand this might not be proper, but the warning is annoying.

@jrpalma
Copy link
Author

jrpalma commented Feb 19, 2020

It turns out that the issue happening due to a double logout in the docker/cli project. I will go ahead and create an issue and pull request on the docker/cli project.

@jrpalma jrpalma closed this as completed Feb 19, 2020
@diegoaguilar
Copy link

@jrpalma Did you solve this in some way?

@smejkal
Copy link

smejkal commented Mar 10, 2022

docker logout without registry means that you logout from the Docker Registry (https://index.docker.io/v1/)

docker logout registry

would work in the sample above.

nicks added a commit to nicks/docker-credential-helpers that referenced this issue Jul 27, 2022
nicks added a commit to nicks/docker-credential-helpers that referenced this issue Jul 27, 2022
fixes docker#174

Signed-off-by: Nick Santos <nick.santos@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants