Access denied when pulling Docker image from a repository I own

32,901

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.

Share:
32,901
dspacejs
Author by

dspacejs

Passionate and well-rounded full-stack engineer. Skilled with Python, Django, React, and plenty more.

Updated on July 09, 2022

Comments

  • dspacejs
    dspacejs almost 2 years

    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'
    
  • BMitch
    BMitch almost 6 years
    The OP is using docker hub, not a private registry server.
  • BMitch
    BMitch almost 6 years
    This does not answer the OPs question.