Docker login to private registry

STEP 1: Docker login to private registry

Lets see the syntax of docker login command followed by the authorized username and the repository URL.

[root@docker03:~]# docker login [DOCKER-REGISTRY-SERVER] -u <username> [-p][your password will be seen here]

The -p is the option for password which can be given along with the docker command or you can type it in the password prompt after hitting enter on the docker login command.

Example given:

[root@docker03:~]# docker login -u vamshi
Login Succeeded

Once the docker login is succeeded a json file will be generated under your home directory at the following path which contains the auth metadata information.

[root@docker03:~]# cat $HOME/.docker/config.json
	"auths": {
		"": {
			"auth": "1234W46TmV0ZW5yaWNoMjAxOQ=="
	"HttpHeaders": {
		"User-Agent": "Docker-Client/18.09.1 (linux)"

The docker login repository URL can be found out from your docker client machine using docker info command if you had previously logged in, as we see below:

[root@docker03:~]# docker info | grep Registry

How to logout from the specific docker registry use the docker logout command.
The syntax is shown as below:

Example given:

[root@docker03:~]# docker logout 
Removing login credentials for

Leave a Comment