docker logout Command Reference
Remove stored credentials for a registry.
docker logout deletes the saved authentication for a registry from the Docker config. It is the cleanup counterpart to docker login, useful at the end of a job to ensure credentials do not linger.
Usage
docker logout [SERVER]- remove credentials for SERVER (defaults to Docker Hub)- No flags; the only argument is the optional registry host
Example
shell
docker logout ghcr.io
docker logoutIn CI
On ephemeral runners the whole environment is discarded after the job, so logout is rarely strictly necessary. On persistent or shared runners, log out at the end of the job (for example in an always() cleanup step) so the next job cannot reuse your registry credentials.
Key takeaways
- logout removes stored auth for one registry, mirroring login.
- On shared or persistent runners, log out to prevent credential reuse.
- On disposable runners the environment is torn down, so logout is optional.
Related guides
docker login Command ReferenceReference for docker login in CI: authenticate to a registry with -u and --password-stdin to avoid leaking cr…
docker context Command ReferenceReference for docker context in CI: create, list, and switch Docker endpoints to target a remote daemon over…
docker push Command ReferenceReference for docker push in CI: publish a tagged image or all tags to a registry, with notes on authenticati…