Agentic AI with Java: Live Cohort
DockerDockerizing Applications

Pushing Image Into Docker Hub Maven

Tag and push a Maven application image to Docker Hub.

After building a Docker image locally, you can push it to Docker Hub so another machine can pull and run it.

This is how Docker images move from your laptop to a server, teammate, or deployment pipeline.

Log in to Docker Hub

Use:

docker login

Enter your Docker Hub username and password or access token.

Build the image

Build your Maven web application image:

docker build -t maven-web-app:1.0 .

Check it:

docker images

Tag the image for Docker Hub

Docker Hub images use this format:

username/repository-name:tag

Tag your local image:

docker tag maven-web-app:1.0 username/maven-web-app:1.0

Replace username with your Docker Hub username.

Push the image

Push it:

docker push username/maven-web-app:1.0

After the upload finishes, open Docker Hub and confirm the repository is visible.

Why tagging matters

The tag tells Docker where to send the image.

Image nameMeaning
maven-web-app:1.0Local image name
username/maven-web-app:1.0Docker Hub image name

Before pushing to Docker Hub, always tag the image with your Docker Hub username. Otherwise Docker does not know which repository should receive it.

Written By: Shiva Srivastava

How is this guide?

Last updated on