Skip to main content

Command Palette

Search for a command to run...

From Local to Global: Sharing Your Docker Images on DockerHub Simplified

Turn your local Docker images into global assets with just a few clicks!

Updated
2 min read
From Local to Global: Sharing Your Docker Images on DockerHub Simplified
C
DevOps Engineer focused on automating workflows, optimizing infrastructure, and building scalable efficient solutions.

Prerequisite:

  • You need to have an account on DockerHub. If you don't have one, you can sign up easily and for free.

Steps to push your image from local to global:

  1. Visit DockerHub and sign in: DockerHub

  2. Click on your profile and then select Account Settings:

  1. Click on "Personal access tokens" located under the Security section:

  1. Now, when using Docker, authentication will be done with a Personal Access Token (PAT) instead of a personal password. Click on Generate new token to create one and add required details.

  1. Docker Login through VM:

    • Access your VM (for example, an AWS EC2 Instance).

    • Run the command docker login.

    • Enter your Docker username (as found on DockerHub).

    • Use the Personal Access Token (PAT) from DockerHub as the password.

  1. Now, we can rename our image from "bankapp-mini" to "dockerhub_username/spring-boot-bankapp".

    • It is recommended to read this blog before proceeding further with the current one: Banking App, as this project will be referenced throughout.

    • To upload this image to a DockerHub repository and make it public, you need to include your DockerHub username in front of the image name. This is necessary because your username must precede any image name on DockerHub.

docker image tag bankapp-mini "DockerHub_username"/springboot-bankapp:latest

#Replace your DockerHub username with "DockerHub_username"

Old docker image name:

New docker image name:

  1. To upload your image to DockerHub, use the following command:
docker push chetan0103/springboot-bankapp:latest
  1. Your image is now publicly available on DockerHub, allowing anyone to use it.

What are benefits of this?

  • Easy Access: Anyone can pull your image instantly.

  • Collaborate: Share and improve with the community.

  • Versioning: Manage multiple image versions.

  • Free Hosting: Host images at no cost.

  1. Remove the containers from VM.

This process allows you to make your Docker image publicly accessible by moving it from local storage to a global platform.

Happy Learning :)

Chetan Mohod ✨

For more DevOps updates, you can follow me on LinkedIn.