Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied when pulling Docker image from a repository I own

I built a Docker image that I pushed to Docker Hub under my account and removed locally after. But when I try to pull it, it throws the following error:

Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'

I'm logged into the same account that owns the repository for this image and can perform other tasks (such as pushing) perfectly fine. The repository also definitely exists on Docker Hub, yet it fails when I try to pull it.

I've tried the following things:

  1. Logging out of my account and back in again
  2. Renaming config.json and regenerating it
  3. Running an isolated Docker container with docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock:ro docker sh, then logging into my account and attempting to pull the image
  4. Deleting and recreating the repository

All of these things still produce the same error. I'm baffled.

To note, both my client and engine versions are 17.12.0-ce. My OS is Ubuntu 17.10 (64-bit).

Console output

docker login

-> % docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: mightyspaj
Password: 
Login Succeeded

docker tag

-> % docker tag dockerfile-assignment-1:latest mightyspaj/dockerfile-assignment-1

docker push

-> % docker push mightyspaj/dockerfile-assignment-1                              
The push refers to repository [docker.io/mightyspaj/dockerfile-assignment-1]
8427a8e6a29f: Pushed 
655a921743e8: Pushed 
8aa44edb7524: Pushed 
60f1a2dc4cd8: Mounted from library/node 
9185fe936b87: Mounted from library/node 
e53f74215d12: Mounted from library/node 
latest: digest: sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160 size: 1582

docker image rm

-> % docker image rm mightyspaj/dockerfile-assignment-1
Untagged: mightyspaj/dockerfile-assignment-1:latest
Untagged: mightyspaj/dockerfile-assignment-1@sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160

docker image pull

-> % docker image pull mightyspaj/dockerfile-assignment-1
Using default tag: latest
Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'
like image 754
dspacejs Avatar asked Feb 16 '18 10:02

dspacejs


People also ask

How do I pull an image from a private docker repository?

In order to pull images from your private repository, you'll need to login to Docker. If no registry URI is specified, Docker will assume you intend to use or log out from Docker Hub. Triton comes with several images built-in. You can view the available list with triton images .

Why docker push 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.

Do I need to login to Docker Hub to pull the images?

Run docker run <your_username>/my-private-repo to test your Docker image locally. You must be signed in to Docker Hub through Docker Desktop or the command line, and you must also name your images correctly, as per the above steps.

How do I push a docker image to a specific repository?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).


1 Answers

I could fix the same issue only when I made the repository public. Make sure the repository is public then this is the set of instructions I followed in command line: Once logout from docker hub and login again.

1- docker logout

2- docker login --username=YOURUSERNAME Enter password when asked

3- docker pull repositoryName"/"imageName[:tag]

if "tag" is not included the default value will be "latest". Then check the images by docker images command to check if its been pulled. After pulling is done I made the repository private again.

like image 69
Neela Avatar answered Oct 04 '22 11:10

Neela