Skip to content

Sharing Docker Images on Docker Hub

An image like the one we created in the Node.js Hello World Docker Container from scratch post is simple, yet it’s a perfect example to try one of the cool features of Docker, provided through Docker Hub, the official hosting service of public and private Docker Images.

Before we can do that, however, we need to register on Docker Hub.

Docker Hub is free in its basic plan which includes unlimited public repos and one private repo. For more than that, there are paid plans.

Once you register and login, you will see your dashboard:

Now using your username, you need to login from the command line using docker login:

docker login --username <username>

Now you can use docker tag to create the image, and docker push to push it to Docker Hub:

docker tag <image> <username>/<tagname>
docker push <username>/<tagname>

If you forget to login, you will get a denied: requested access to the resource is denied error message when you run docker push.

Now you should see your image on the repositories list in Docker Hub:

Click on it to reveal more details:

Now since the image is public, everyone can use it to create their own containers, or use it as a base image.

You can now create a new tag, making a new version of the image, and there’s a lot more you can do that I won’t go into now, like:


→ I wrote 17 books to help you become a better developer:

  • C Handbook
  • Command Line Handbook
  • CSS Handbook
  • Express Handbook
  • Git Cheat Sheet
  • Go Handbook
  • HTML Handbook
  • JS Handbook
  • Laravel Handbook
  • Next.js Handbook
  • Node.js Handbook
  • PHP Handbook
  • Python Handbook
  • React Handbook
  • SQL Handbook
  • Svelte Handbook
  • Swift Handbook
...download them all now!

Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025

Bootcamp 2025

Join the waiting list