Docker

Docker tutorial – How to upload Docker Image to public registry Docker Hub

Pinterest LinkedIn Tumblr

Docker Hub is a service provided by Docker for finding and sharing container images with your team. It allows us to pull and push docker images to and from Docker Hub. We can treat this as a GitHub, where we fetch and push our source code, but in the case of Docker Hub, we download or publish our container images.

Docker hub is a cloud-based online repository that stores both types of repositories, i.e., pubic repository as well as the private repository. Public repositories are accessible to everyone, but the private one is accessible to the concerned owner of the repositories; also there is a cost associated with it if we store more than a certain number of repositories as a private.

Docker Hub features:

  • Repositories: Push and pull container images.
  • Teams & Organizations: Manage access to private repositories of container images.
  • Official Images: Pull and use high-quality container images provided by Docker.
  • Publisher Images: Pull and use high- quality container images provided by external vendors.
  • Builds: Automatically build container images from GitHub and Bitbucket and push them to Docker Hub.
  • Webhooks: Trigger actions after a successful push to a repository to integrate Docker Hub with other services.

Sign up for a Docker hub account

Access the url https://hub.docker.com/signup and register an account before go to next step.

Create your repository

Click create repository and select private or public repository depend on your project

create repository docker hub

Building an image Docker

You can refer to this post for building image Docker

$ git clone https://github.com/learncode24h/build-image-docker-nodejs-application
$ docker build -t learncode24h/docker-node-hello .

Push image Docker to Docker hub

Before push an image to Docker hub we need to authenticate with Docker hub.
$ 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: learncode24h
Password: 
WARNING! Your password will be stored unencrypted in /home/learncode24h/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

$ docker push learncode24h/docker-node-hello:latest
The push refers to repository [docker.io/learncode24h/docker-node-hello]
7d5030770d6f: Pushed 
bb1701e91f31: Pushed 
ed7d747d9633: Pushed 
580641d88796: Pushed 
a542fcf84126: Pushed 
4ebe27287e94: Mounted from library/node 
abdde7643382: Mounted from library/node 
909542b1bce2: Mounted from library/node 
7de462056991: Mounted from library/node 
3443d6cf0f1f: Mounted from library/node 
f3a38968d075: Mounted from library/node 
a327787b3c73: Mounted from library/node 
5bb0785f2eee: Mounted from library/node 
latest: digest: sha256:84add6a59ecbd383ad70928f5e5fb1b3cb1ee3f52d93a3140601a8f8241beea4 size: 3055
$ docker logout (for security reason)

And now access the docker hub you will see your image is public on the docker hub.

I'm a full stack developer. I have experiences with Java, Android, PHP, Python, C#, Web development...I hope website https://learncode24h.com will help everyone can learn code within 24h and apply it in working easily.

Comments are closed.