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 logout #1091

Open
hrobertson opened this issue Jun 15, 2016 · 7 comments
Open

docker logout #1091

hrobertson opened this issue Jun 15, 2016 · 7 comments

Comments

@hrobertson
Copy link

Is there a reason that there is no equivalent of docker logout?

I imagine this would take a registry (str) and dockercfg_path (str) as parameters and simply remove the appropriate section from the file.

@shin-
Copy link
Contributor

shin- commented Jun 15, 2016

By design, docker-py doesn't modify the config file.

@hrobertson
Copy link
Author

Is there some record of design discussions regarding this that I can read?

@nballenger
Copy link

This would be useful. Right now I'm having to run a subprocess call to log out of an ECR registry, because otherwise my credential store is attempting to use an expired temporary auth token from the last push I did, and ignoring the newly acquired token I'm passing to docker_client.login, despite passing reauth=True. If logout is verboten from the python SDK, maybe it'd be good if the login method actually paid attention to reauth?

@vukobrat
Copy link

vukobrat commented Apr 1, 2019

Lets try 3 years later...do we have docker logout now? :)

@saifrahmed
Copy link

Based on @shin- 's comment,
"By design, docker-py doesn't modify the config file."
It would suggest that docker-py logins are not persistent outside the session they were used in, could anyone verify this is the case?

@vsoch
Copy link

vsoch commented Jun 10, 2021

+1 for this issue - I would like to have docker logout for my use case! For ORAS the client has a docker logout: https://github.com/oras-project/oras-go/blob/main/pkg/auth/docker/logout.go.

@adippel
Copy link

adippel commented Jul 30, 2021

I can confirm @saifrahmed assumption that logins which were performed within the session are not persisted beyond the docker-py session, i. e. the auths dict in the config specified by the dockercfg_path parameter is not altered by calling #login(). However, logins specified in the auths dict are "used" by docker-py to access registries.

Thus, the behavior is consistent. No explicit logout in docker-py is needed, since a logout is implicit by destroying the session. Likewise, docker-py cannot logout from registries which were accessed via a docker login command line call. A logout is only possible by calling docker logout from the command line.

Using docker-py == 5.0.0

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

7 participants