What is a Docker Hub
Docker Hub is the central place used for keeping the Docker images either in a public or private repository. Docker Hub provides features, such as a repository for Docker images, user authentications, automated image builds, integration with GitHub or Bitbucket, and managing organizations and groups. The Docker Registry component of Docker Hub manages the repository for Docker images.
Creating Repository In Dcoker
1. Display the current info about the docker host.
# docker info
2. Using a browser, open the URL “hub.docker.com” and register an id by passing required information.
3. Once logged in, create the repository. Provide the required details like – Name, Short Description, Detailed description etc. We are making the repository as Public as shown below.
4. Below is a public repository after it has been created.
Connecting the Docker repository remotely from command line
1. Once the repository is created use the login command from the Docker node to get connected.
# docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: geeklab Password: Login Succeeded
2. Once the user has logged in, the info command will show the username assigned to the node.
# docker info .... Username: geeklab Registry: https://index.docker.io/v1/
3. The information is stored in the local users home directory. Multiple users in the same host can connect to different repositories.
# cat .docker/config.json { "auths": { "https://index.docker.io/v1/": { "auth": "Z2Vla2xhYjp2YXNoaTEyMw==" } }, "HttpHeaders": { "User-Agent": "Docker-Client/17.10.0-ce (linux)" } }
4. To verify that you have connected correctly to the remote reposityr “geeklab”, use the following command.
# docker search geeklab/* NAME DESCRIPTION STARS OFFICIAL AUTOMATED geeklab/test_repo This the first Test repo. 0
Logout from the docker hub
To logout from the docker login, use the command below :
# docker logout Removing login credentials for https://index.docker.io/v1/
2. If you Now check the .docker/config,json file, the previous entry for the geeklab user would be deleted.
# cat .docker/config.json { "auths": {}, "HttpHeaders": { "User-Agent": "Docker-Client/17.10.0-ce (linux)" }
3. Also, you would not find any information about the use in the “docker info” command.
# docker info | grep -i user