Goglides Dev 🌱

Goglides Dev 🌱 is a community of amazing users

We are working on this space so that IT professionals can grow together.

Create account Log in
Niraj Pradhan
Niraj Pradhan

Posted on • Originally published at goglides.dev

Publish container image to the remote registry docker hub

Alright, if you are familiar with docker, docker-container and container image then you must have heard about docker hub.

Docker hub

Docker hub is a cloud based service to create, manage, test, deploy container application repositories. In simple, we can create a repository and we can push the container image in that repository. Public and Opensource repository can be used by anyone just by pulling image to the system. It is basically a hub for container images.

In the previous post, i have containerized react application and run the application through the container.

Lets get into the docker hub

To get started, make sure to create account in the docker hub. If you don't have docker hub account yet, visit Docker hub and create account first.

Create repository

Create Repository

View Repositories

View Respositories

Lets check container images in our system,

~ docker images
Enter fullscreen mode Exit fullscreen mode

Docker Images

Our container image react-app has a tag name latest by default, so we can change it to our first tag name as v1.

~ docker tag react-app:latest react-app:v1
Enter fullscreen mode Exit fullscreen mode

Lets check container images again,

~ docker images
Enter fullscreen mode Exit fullscreen mode

Update Tag

Or we can just build container image again by assigning tag name,

~ docker build -t react-app:v2 .
Enter fullscreen mode Exit fullscreen mode

Lets check container images again,

~ docker images
Enter fullscreen mode Exit fullscreen mode

Update Tag v2

Now we can tag local container image to remote repository

~ docker tag f8a7e190bb57 nirajpdn/react-app:v1
Enter fullscreen mode Exit fullscreen mode

Lets publish image to the docker hub

Now, we can publish local container image to the docker hub with command:

~ docker push nirajpdn/react-app:v1
Enter fullscreen mode Exit fullscreen mode

If you get an issue of denied: requested access to the resource is denied and not able to push the image to the remote repository because we haven't logged in to docker hub from our system. Lets login with:

~ docker login
Enter fullscreen mode Exit fullscreen mode

After successfully logged in to docker hub.
Lets do above docker push nirajpdn/react-app:v1 command again.

~ docker push nirajpdn/react-app:v1
Enter fullscreen mode Exit fullscreen mode

Push success
Success 🎉 , lets check our remote repository.

Image with tag pushed

We did it. Congratulations. 😄

We already have image with tag react-app:v2 in our local system. If you want to push that again with tag v2 in remote resository.

~ docker tag 0a67bb68a7fb nirajpdn/react-app:v2
Enter fullscreen mode Exit fullscreen mode

Push the image again.

~ docker push nirajpdn/react-app:v2
Enter fullscreen mode Exit fullscreen mode

Lets check remote repository again.

Push v2 Image

Keep doing.

Discussion (0)