Originally posted at kodlogs.net
Docker is one of the most widely used open source platform that enables developers to package applications into containers. Containers are nothing but a standard unit of software that packages up the code and all its dependencies. This helps the application to run quickly and reliably from one computing environment to another.
A Docker image contains a set of instructions in a file that can be used to execute code in a Docker container. Mostly after creating a docker image when we try to push the image into our repository this type of error occurs “Docker denied: requested access to the resource is denied”
Why this error occurs?
As the error says requested access to the resource is denied error, you as a docker user do not have the correct rights/permission to run the docker push or any other docker command. Or your docker hub credentials are incorrect.
How to resolve :
To overcome this error follow this two methods of solutions
Solution 1: First, check your docker hub credentials whether you have entered the right credentials or not.
If you have entered your credentials correctly then this error persists try logging out and again log in using your credentials.
For logout use,
docker logout
Again login using,
docker login
In some cases, this solution might work.
Solution 2: If still, you are getting this error after trying solution 1 you have to follow this solution which will clear the error.
First, after your login you have to tag your image before pushing:
docker tag image_name YOUR_DOCKERHUB_NAME/image_name
then, you have to push it.
docker push YOUR_DOCKERHUB_NAME/image_name
After doing this you will be able to push your docker image into your repository and the error will be gone.
Conclusion: In this tutorial, we have seen about “Docker denied: requested access to the resource is denied” error which can be solved using the above-mentioned solutions. We have to remember that before pushing the docker image into the repository we have to tag our image and try to push the image into the repository.