• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Create a Public/Private Repository in Docker Hub and connect it remotely using command line

By admin

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.

docker repository hub sign up

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.

create first docker repository or private hub

Create docker repository - provide required details

4. Below is a public repository after it has been created.
Public repository in docker after creation

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

Filed Under: DevOps, Docker

Some more articles you might also be interested in …

  1. How to Pause and Resume Docker Containers
  2. How to Create a MySQL Docker Container for Testing
  3. “su: Authentication failure” – in Docker
  4. How to update/add a file in the Docker Image
  5. What are Shell Scripts? How to Create Shell Scripts?
  6. How to change the default IP address of docker bridge
  7. ‘docker images’ command error – “Permission Denied”
  8. How to List / Start / Stop / Delete docker Containers
  9. How To Access Kubernetes Dashboard Externally
  10. How to install Docker on Mac

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ICMP redirects on CentOS/RHEL
  • What are Oracle Key Vault Roles
  • What Is Oracle Key Vault
  • Auditing with Oracle Database Vault Reports
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary