8

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'
shgnInc
  • 2,054
  • 1
  • 23
  • 34
Daniel
  • 3,115
  • 5
  • 28
  • 39

3 Answers3

1

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.

Neela
  • 87
  • 6
-1

If you want, you can also get things done by doing it this way.

  1. Add CMD sleep 3600 via Dockerfile
  2. Docker build -t my-app-project.
  3. Open Docker Desktop and proceed to the stage in the image below

enter image description here

  1. Press the run button in the Actions section and perform the following steps

enter image description here

  1. First, specify the project container name
  2. Red color will be your project path
  3. The green one will run the project you set as volume will be the location (container)

Not: If the port setting is 1 or 2 assign numeric numbers

I hope it was a helpful topic for you

Umit KOC
  • 224
  • 2
  • 6
-3

This solution is only valid on private docker repositories!!

First try to login on your private repo e.g:

docker login dockerrepo.example.com

Then If you build new image with dockerfile based on image in your private repository then you must prefix your base image with private repository url:

FROM PRIVATE_REPO_URL + IMAGE_INFO

sample:

PRIVATE_REPO_URL --> dockerrepo.example.com
BASE_IMAGE --> samples/java/jdk:1.6

Your dockerfile look like this:

FROM dockerrepo.example.com/samples/java/jdk:1.6
nix
  • 744
  • 9
  • 16