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 logout
In 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.
Frequently asked questions
docker logout Command Reference?
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.
In 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.