108
votes

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.

21

21 Answers

82
votes

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. I hope this helps someone.

16
votes

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
13
votes

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
11
votes

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
6
votes

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

FROM python:3.7-alpine

5
votes

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
4
votes

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 ...
2
votes

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.

2
votes

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>

2
votes

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.

2
votes

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
1
votes

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

1
votes

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.

1
votes

Try this in your docker-compose.yml file

image: php:rc-zts-alpine
1
votes

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.

1
votes

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.

1
votes

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".

1
votes

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

1
votes

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.

0
votes

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

0
votes

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