229

I am using Laravel 4.2 with docker. I setup it on local. It worked without any problem but when I am trying to setup online using same procedure then I am getting error:

pull access denied for <projectname>/php, repository does not exist or may require 'docker login'

is it something relevant to create repository here https://cloud.docker.com/ or need to docker login in command?

After days of study I am still not able to figure out what could be the fix in this case and what are the right steps?

I have the complete code. I can paste here if need to check certain parts.

John Smith
  • 7,243
  • 6
  • 49
  • 61
Jass
  • 3,345
  • 3
  • 24
  • 41
  • Sometimes it is just because you didn't build the required image. When you have both Dockerfile and docker-compose.yml file in which you declared that there is one image that depends on another one (which is not built locally yet). So you need to `docker build` the needed image first. – Ebenezer Nikabou Apr 24 '23 at 16:30

33 Answers33

178

Please note that the error message from Docker is misleading.

$ docker build deploy/.
Sending build context to Docker daemon  5.632kB
Step 1/16 : FROM rhel7:latest
pull access denied for rhel7, repository does not exist or may require 'docker login'

It says that it may require 'docker login'. I struggled with this. I realized the image does not exist at https://hub.docker.com any more.

starball
  • 20,030
  • 7
  • 43
  • 238
Daniel Nelson
  • 1,968
  • 1
  • 12
  • 11
  • 5
    Or you are logged in with email address instead of docker id. https://stackoverflow.com/questions/35644329/docker-hello-world-authentication-error/35644630#35644630 – Daniel Nelson Jan 10 '19 at 15:09
  • 2
    Thanks for pointing this out. That error message is indeed very misleading since in my case the image simply didn't exist. But I had a remote repository configured that was not available at the time. So when docker couldn't find the image in my local repo, it tried that remote one and failed. It would be nice if docker displayed the name of the repository in the error, so you are aware what is happening under the covers. – Anne van Leyden Nov 22 '19 at 07:57
  • 1
    In my case, I entered a wrong docker command-- which is the same as the image not existing in repo. – A.C Jan 18 '21 at 20:27
  • 2
    Thanks .. this is a very misleading error .. in my case, it was incorrect syntax .. .I didn't realize I had typed `docker create service` when the correct usage is `docker service create` – rugby2312 Apr 18 '21 at 08:50
  • 2
    The error is misleading. The image is simple missing. You might have to load image or in my case a I needed to run another Dockerfile to create the image needed by my next Dockerfile. – gaoithe Jun 11 '21 at 10:54
  • 1
    yes the error is misleading.... In my case it was a type instead of alpine I wrote apline – PravinY Aug 09 '21 at 09:42
  • 1
    Like with @gaoithe, I also had to run an sh script to build an image from a Dockerfile. I did not know that and ran another starting sh script but that already needed the build sh script to be run before. – questionto42 Dec 22 '21 at 17:43
  • For me, I didn't realize I needed to preface detach with 2 dashes: `docker container run ... --detach ...` – Travis Heeter May 03 '23 at 20:24
  • For me `docker build -t image-name .` hade one image name and my `docker-compose.yml` had a different image name (typo) – afarah May 25 '23 at 13:50
57

Just make sure to write the docker name correctly!

In my case, I wrote (notice the extra 'u'):

FROM ubunutu:16.04

The correct docker name is:

FROM ubuntu:16.04
Moka
  • 988
  • 10
  • 10
26

The message usually comes when you put the wrong image name. Please check your image if it exists on the Docker repository with the correct tag. It helped me.

docker run -d -p 80:80 --name ngnix ngnix:latest
Unable to find image 'ngnix:latest' locally
docker: Error response from daemon: pull access denied for ngnix, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
$ docker run -d -p 80:80 --name nginx nginx:latest
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
Vishnu Dubey
  • 261
  • 3
  • 5
19

I had the same issue. In my case it was a private registry. So I had to create a secret as shown here

and then we have to add the image pull secret to the deployment.yaml file as shown below.

pods/private-reg-pod.yaml  
apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: <your-private-image>
  imagePullSecrets:
  - name: regcred
hushed_voice
  • 3,161
  • 3
  • 34
  • 66
13

November 2020 and later

If this error is new, and pulling from Docker Hub worked in the past, note Docker Hub now introduced rate limiting in Nov 2020

You will frequently see messages like:

Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.

From Circle CI and other similar tools that use Docker Hub. Or:

Error response from daemon: pull access denied for cimg/mongo, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

You'll need to specify the credentials used to fetch the image:

For CircleCI users:

      - image: circleci/mongo:4.4.2

        # Needed to pull down Mongo images from Docker hub
        # Get from https://hub.docker.com/
        # Set up at https://app.circleci.com/pipelines/github/org/sapp
        auth:
          username: $DOCKERHUB_USERNAME
          password: $DOCKERHUB_PASSWORD
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
  • I did this, set up the username and password as environment variables on circleci console for my project and it's still telling me `Error response from daemon: pull access denied for nyck33/myimage, repository does not exist or may require 'docker login': denied: requested access to the resource is denied` – mLstudent33 Sep 30 '21 at 02:49
9

I solved this by inserting a language at the front of the docker image

FROM python:3.7-alpine

kodek-sleuth
  • 185
  • 2
  • 6
8

I had the same issue

pull access denied for microsoft/mmsql-server-linux, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Turns out the DockerHub was moved to a different name So I would suggest you re check-in docker hub

Jeet Singh
  • 81
  • 1
  • 6
8

In my case I was using a custom image and docker baked into Minikube on my local machine.

I had specified the pull policy incorrectly:-

imagePullPolicy: Always

But it should have been:-

imagePullPolicy: IfNotPresent

Because the custom image was only present locally after I'd explicitly built it in the minikube docker environment.

mattocaramba
  • 121
  • 1
  • 3
6

I had the same error message but for a totally different reason.

Being new to docker, I issued

docker run -it <crypticalId>

where <crypticalId> was the id of my newly created container.

But, the run command wants the id of an image, not a container.

To start a container, docker wants

docker start -i <crypticalId>

Gyro Gearloose
  • 1,056
  • 1
  • 9
  • 26
5

I had the same issue when working with docker-composer. In my case it was an Amazon AWS ECR private registry. It seems to be a bug in docker-compose

https://github.com/docker/compose/issues/1622#issuecomment-162988389

After adding the full path "myrepo/myimage" to docker compose yaml

image: xxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/myrepo:myimage

it was all fine.

Stefan Matei
  • 1,076
  • 11
  • 10
5

I had this because I inadvertantly remove the AS tag from my first image:

ex:

FROM mcr.microsoft.com/windows/servercore:1607-KB4546850-amd64
...
.. etc ...
...
FROM mcr.microsoft.com/windows/servercore:1607-KB4546850-amd64
COPY --from=installer ["/dotnet", "/Program Files/dotnet"]
... etc ...

should have been:

FROM mcr.microsoft.com/windows/servercore:1607-KB4546850-amd64 AS installer
...
.. etc ...
...
FROM mcr.microsoft.com/windows/servercore:1607-KB4546850-amd64
COPY --from=installer ["/dotnet", "/Program Files/dotnet"]
... etc ...
Post Impatica
  • 14,999
  • 9
  • 67
  • 78
3

If the repository is private you have to assign permissions to download it. You have two options, with the docker login command, or put in ~/.docker/docker.config the file generated once you login.

3

Docker might have lost the authentication data. So you'll have to reauthenticate with your registry provider. With AWS for example:

aws ecr get-login --region us-west-2 --no-include-email

And then copy and paste that resulting "docker login..." to authenticated docker.

Source: Amazon ECR Registeries

iAmcR
  • 859
  • 11
  • 10
  • In my case, the registry was placed in Google Cloud, and I was logged out of my gcloud account. I noticed in config.json, the credHelpers keys and values, for example: "credHelpers": { "asia.gcr.io": "gcloud" } This suggested that I may need to log in to my gcloud account. Hope it helps someone – Syed Abdul Wahab Oct 31 '22 at 06:36
  • Worked for me ! Thanks – Alouani Younes Jun 07 '23 at 20:59
3

This error message might possibly indicate something else.

In my case I defined another Docker-Image elsewhere from which the current Docker inherited its settings (docker-compos.yml):

FROM my_own_image:latest

The error message I got:

qohelet$ docker-compose up
Building web
Step 1/22 : FROM my_own_image:latest
ERROR: Service 'web' failed to build: pull access denied for my_own_image, repository does not exist or may require 'docker login'

Due to a reinstall the previous Docker were gone and I couldn't build my docker using docker-compose up with this command:

sudo docker build -t my_own_image:latest -f MyOwnImage.Dockerfile .

In your specific case you might have defined your own php-docker.

Qohelet
  • 1,459
  • 4
  • 24
  • 41
3

if you have over two stage in the docker build process read this solution: this error message is completely misleading.

if you have a two-stage (context) dockerfile and want to copy some data from the first to the second stage, you must label the first context (ex: build) and access it by that label

#stage(1)
from <image> as build 
.
.
#stage(2)
From <image>
copy --from=build /sourceDir  /distinationDir
3

I had to run docker pull first, then running docker-compose up again and then it worked.

docker pull index.docker.io/youruser/yourrepo:latest
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Jhnsbrst
  • 318
  • 1
  • 14
  • Thanks! I was following Dapr + docker-compose docks and they don't mention anything about docker pull first – Geordie Feb 15 '22 at 00:04
2

If you're downloading from somewhere else than your own registry or docker-hub, you might have to do a separate agreement of terms on their site, like the case with Oracle's docker registry. It allows you to do docker login fine, but pulling the container won't still work until you go to their site and agree on their terms.

J-ho
  • 238
  • 3
  • 17
2

Make sure the image exists in docker hub. To me, I was trying to pull MongoDB using the command docker run mongodb which is incorrect. In the docker hub, the image name is mongo.

Sathishkumar Rakkiyasamy
  • 3,509
  • 2
  • 30
  • 34
2

If you don't have an image with that name locally, docker will try to pull it from docker hub, but there's no such image on docker hub. Or simply try "docker login".

Max Sherbakov
  • 1,817
  • 16
  • 21
2

If you are using multiple Dockerfiles you should not forget to run build for all of it. That was my case.

renkse
  • 502
  • 7
  • 15
2

For private repo.

use this patten username/image:tag

example, rohitnishad613 is my docker usernam

rohitnishad/some-app:latest
Rohit Nishad
  • 2,570
  • 2
  • 22
  • 32
1

Try this in your docker-compose.yml file

image: php:rc-zts-alpine
Hardik Raval
  • 3,406
  • 1
  • 26
  • 28
1

Exceeded Docker Hub's Limit on Free Repos:

Despite first executing:

docker login -u <dockerhub uname>

and "Login Succeeded" being returned, I received the error in this question.

In the webgui in Settings > Visibility Settings I remarked:

Using 2 of 1 private repositories.

Which told me that I had exceeded the limit on Docker Hub's free account limits. However, removing a previous image didn't clear the error...

The Fix:

Indeed, the error message in my case was a red herring- it's nothing related to authentication issues.

Deleting just the images exceeding the allowed limit did NOT clear the error however!

To get past the error you need to delete ALL the images in your FREE Docker Hub account, then run a new build pushing the image to your account.

Your pull command will now succeed.

F1Linux
  • 3,580
  • 3
  • 25
  • 24
0

When I run the command multiple times "docker pull scrapinghub/splash" in Power shell then it solve the issue.

kamran kausar
  • 4,117
  • 1
  • 23
  • 17
0

if it was caused with AWS EC2 and ECR, due to name issue(happens with beginners!)

Error response from daemon: pull access denied for my-app, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

when using docker pull use Image URI of the image, available in ECR-row itself as Copy URI

docker pull Image_URI
Ajay Tom George
  • 1,890
  • 1
  • 14
  • 26
0

I have seen this message and thought something was wrong about my Docker authentication. However, I've realized that Docker only allows 1 private repository per free plan. So it is quite possible that you are trying to pull your private repository and see this error because have not upgraded your plan.

Mert Sevinc
  • 929
  • 1
  • 8
  • 25
0

Got the same problem but nothing worked. And then I understood I need run .sh (.ps1) script first before doing docker-compose.

So I have the following files:

   docker-compose.yml
   
   docker-build.sh
   
   docker-build.ps1
   
   Dockerfile

And I had to first run docker-build.sh on Unix (Mac) machine or docker-build.ps1 on Windows:

sh docker-build.sh

It will build an image in my case. And only then after an image has been built I can run:

docker-compose up --build

For references. Here is my docker-compose file:

version: '3.8'

services:

  api-service:
    image: x86_64/prediction-service:0.8.1
    container_name: api-service
    expose:
      - 8060
    ports:
      - "8060:80"    

And here is docker-build.sh:

VERSION="0.8.1"
ARCH="x86_64"
APP="prediction-service"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
docker build -f $DIR/Dockerfile -t $ARCH/$APP:$VERSION .
illuminato
  • 1,057
  • 1
  • 11
  • 33
0

I had misspelled nginx to nignx in Dockerfile

Nishant Kumar
  • 691
  • 1
  • 11
  • 31
0

In my case the solution was to re-create docker-file through visual studio and all worked perfeclty.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

I heard the same issue. I solved by login

docker login -u your_user_name

then I was prompt to enter docker hub password The rest command work perfect after login successfull

0

Someone might come across the same error for different reasons than what is already presented, so let me share:

I got the same error when using docker multistage builds (Multiple: FROM <> as <>). And I forgot to remove one (COPY --from=<> <>)

After removing that COPY then it worked fine.

P. Sithole
  • 151
  • 1
  • 13
0

I had the same problem, none of the provided solutions helped. For me a Login was necessary, but I spend a couple of time figuring out that I have to add the Server Path to the pull command:

docker login registry-1.docker.io -u <DOCKER_USERNAME> -p <DOCKER_ACCESS_TOKEN>
docker pull registry-1.docker.io/<DOCKER_USERNAME>/<REPO_TAG>:latest

The Server registry-1.docker.io is the default Servername of Docker Hub

Lukas
  • 21
  • 5
0

I had to re-build the container! Nothing else worked for me.

docker run build <imagename>
Matteus Barbosa
  • 2,409
  • 20
  • 21