Docker : How to push docker image to docker hub – resolving error – “denied: requested access to the resource is denied”

Pushing the docker image to docker hub
Pushing the docker image to docker hub

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

Today new issue and resolution 🙂

Background :

  1. I was preparing an article for setting up Kubernetes cluster in local environment for demo / learning
  2. In one of our previous article – Docker – Introduction to Containers and Docker – part 2 – Creating first Docker program – our first container with detailed steps 🙂 we have created our first docker image / container
  3. So I need to create local Kubernetes cluster and deploy our first docker image / container
  4. To deploy our docker image in Kubernetes cluster we need to store somewhere so that get pulled and deployed in Kubernetes cluster
  5. I am trying to push our docker image in docker hub and getting an error
  6. I am using my ubuntu vm created on free/trial Azure subscription

Error / Issue :

denied: requested access to the resource is denied

Docker - Error while pushing the docker image to public docker hub
Fig : Docker – Error while pushing the docker image to public docker hub

Solution:

  • After googling bit and reading I found that there are certain steps/rules which we need to follow to publish our image to docker hub
  • We need to tag our docker image using docker tag command
prasham@KnowledgeJunction-Ubuntu:~$ docker tag knowledgejunction prashamsabadra/knowledgejunction

Fig : Docker - tagging the image
Fig : Docker – tagging the image
  • Once we tagged our image we need login with our Docker ID
  • If we don’t have Docker ID we can create our docker id from the site – https://hub.docker.com/ as
Fig : Docker - Creating docker id from docker hub
Fig : Docker – Creating docker id from docker hub (Image courtesy from https://hub.docker.com/ )
  • Here, please notice I have my docker id – prashamsabadra
  • Log in to docker hub using our docker id using command docker login
prasham@KnowledgeJunction-Ubuntu:~$ docker login

Fig : Docker - log in command
Fig : Docker – log in command
  • Once we successfully logged in, we are ready to push our docker image using docker push command
prasham@KnowledgeJunction-Ubuntu:~$ docker push prashamsabadra/knowledgejunction:latest

Fig : Pushing the docker image to docker hub
Fig : Pushing the docker image to docker hub
  • Here, please note that name of our image is our dockerid/imagename => prashamsabadra/knowledgejunction

Thanks 🙂

STAY HEALTHY 🙂 STAY SAFE 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: