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 Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

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

Discover more from Microsoft 365

Subscribe now to keep reading and get access to the full archive.

Continue reading