STEP 1: Docker login to private registry
Lets see the syntax of docker login command followed by the authorized username and the repository URL.
Syntax:
[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 nexusreg.linuxcent.com:5000 -u vamshi Password: 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": { "nexusreg.linuxcent.com:5000": { "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 Registry: https://index.docker.io/v1/
How to logout from the specific docker registry use the docker logout command.
The syntax is shown as below:
docker logout [DOCKER-REGISTRY-SERVER]
Example given:
[root@docker03:~]# docker logout Removing login credentials for https://index.docker.io/v1/