Logout from Docker Registry
Docker is one of the best containerization tools used by a lot of industries which helps build, test and deploy applications in an effective manner without any target environment dependency. The docker images can be hosted either on a private docker registry which is maintained by individual organizations or certain images could be hosted on a public docker registry which is accessible by anyone. The docker images can be pulled from the target docker registry on a need basis.
In this article let us understand how to log out of the docker registry.
Understand the docker logout command
Docker logout is only possible via the command line. The docker logout command logs out of the docker registry.
To know more about what the command is used for, type the command mentioned below
$ docker logout --help
Output
Usage: docker logout [SERVER]
Log out from a Docker registry.
If no server is specified, the default is defined by the daemon.
What does the docker logout command do?
The command is used to log out of a docker registry located on a specified server. The server value could be either a URL or the hostname. If you do not specify the server value, the command will try to log out of the public registry which is located here - https://registry-1.docker.io/
by default.
Example
$ docker logout
Output
Removing login credentials for https://index.docker.io/v1/
Logout from the registry on your localhost
In order to logout from the registry on the localhost, you can use the below command.
$ docker logout localhost:8080
Output
Removing login credentials for localhost:8080
How to remove the docker credentials
By default, whenever you login to docker registries, the command stores the credentials inside the $HOME/.docker/config.json
path in base64 encoded format.
In order to remove the docker credentials you have to remove the entry in $HOME/.docker/config.json
Conclusion
I hope this article helped you understand more about the docker logout command. In case of any queries please feel free to reach out to us and we will respond back at the earliest.
Thanks for reading. Happy learning!!
References
https://docs.docker.com/engine/reference/commandline/logout/
https://stackoverflow.com/questions/61953737/docker-how-to-log-out-from-all-remote-registries