Unable to find docker image locally
Asked Answered
B

14

115

I was following this post - the reference code is on GitHub. I have cloned the repository on my local.

The project has got a react app inside it. I'm trying to run it on my local following step 7 on the same post:

docker run -p 8080:80 shakyshane/cra-docker

This returns:

Unable to find image 'shakyshane/cra-docker:latest' locally
docker: Error response from daemon: pull access denied for shakyshane/cra-docker, repository does not exist or may require 'docker login'.
See 'docker run --help'.

I tried login to docker again but looks like since it belongs to @shakyShane I cannot access it.

I idiotically tried npm start too but it's not a simple react app running on node - it's in the container and containers are not controlled by npm

Looks like docker pull shakyshane/cra-docker:latest throws this:

Error response from daemon: pull access denied for shakyshane/cra-docker, repository does not exist or may require 'docker login'

So the question is how do I run this docker image on my local mac machine?

Blaise answered 9/6, 2019 at 7:31 Comment(7)
First pull the docker image using the command "docker pull shakyshane/cra-docker:latest"Hamnet
@Hamnet I will try it now. Thanks!Blaise
What is the exact build command you used in step 6?Harvell
@JoachimIsaksson I cloned the whole repository. The step 6 is the DockerfileBlaise
Step 6 instructs you to run docker build . -t shakyshane/cra-docker. That builds the image with the name shakyshane/cra-docker which you are trying to use in step 7. Since it cannot be found, it would seem the image was not built, at least not with the same name.Harvell
@JoachimIsaksson Damn you, man! Holy moly! I used docker build . -t xameeramir/cra-docker I think this is where I am a culprit.Blaise
Unfortunately, I find myself in this situation when the image exists, but the docker run command comes from a shell script that is executed on the terminal from the same dir as the command itself. So when running the command manually, it runs. When running the same command from a shell script at the same directory level, it fails... If you read this and have the same problem, maybe raise a new question.Insolate
B
67

Well this is illogical but still sharing so future people like me don't get stuck.

The problem was that I was trying to run a docker image which doesn't exist.

I needed to build the image:

docker build . -t xameeramir/cra-docker

And then run it:

docker run -p 8080:80 xameeramir/cra-docker
Blaise answered 9/6, 2019 at 8:7 Comment(0)
P
41

In my case, my image had TAG specified with it and I was not using it.

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
testimage          testtag            189b7354c60a        13 hours ago        88.3MB

Unable to find image 'testimage:latest' locally for this command docker run testimage

So specifying tag like this - docker run testimage:testtag worked for me

Pilchard answered 10/6, 2020 at 9:55 Comment(2)
Hi (docker newb here), excuse my ignorance please. How did you print that top line of your comment, with the repo details??Austronesian
It's docker image listSlotter
A
40

Posting my solution since non of the above worked. Working on macbook M1 pro.

The issue I had is that the image was built as arm/64. And I was running the command:

docker run --platform=linux/amd64 ...

So I had to build the image for amd/64 platform in order to run it.

Command below:

docker buildx build --platform=linux/amd64 ...

In conclusion your docker image platform and docker run platform needs to be the same from what I experienced.

Azeria answered 25/2, 2022 at 17:41 Comment(3)
that was exactly my issue, the error is image not found if the image is the wrong architecture. thanks for your answer!Formulaic
I had a similar problem when switching to M1... docker build --platform=amd64 -t foo . and then docker run --platform=amd64 foo would complain it couldn't find the image. If I remove the platform flag on docker run then it finds it but warns. Instead the right fix was using the full platform linux/amd64 on the run command. I added it to the build command too for symmetry.Adaminah
I just tried! docker run --platform=linux/amd64 [CONTAINER_ID], but not work (unable to find image), what did i go wrong?Aguish
S
9

In my case, the docker image did exist on the system and still I couldn't run the container locally, so I used the exact image ID instead of image name and tag, like this:

docker run myContainer c29150c8588e
Shelli answered 21/6, 2021 at 17:53 Comment(0)
S
8

I received this error message when I typed the name/character wrong. That is, "name1\name2" instead of "name1/name2" (wrong slash).

Swords answered 31/1, 2020 at 20:22 Comment(1)
You are a good man bro, it worked for me too :))), the issue is the path of linux vs windows which in this case it is windows based path and it worked ::)))Pinchbeck
C
3

This just happened to me because my local docker vm on macos ran out of disk space.

I just deleted some old images using docker image prune and it started working correctly again.

Corinnacorinne answered 21/8, 2020 at 18:15 Comment(0)
F
2

In my case, I saw this error when I had logged in to the dockerhub in my docker desktop. The repo I was pulling was local to my enterprise. Once i logged out of dockerhub, the pull worked.

Fiscus answered 9/6, 2020 at 18:36 Comment(0)
C
1

shakyshane/cra-docker Does not exist in that user's repo https://hub.docker.com/u/shakyshane/

Ctenoid answered 9/6, 2019 at 12:11 Comment(1)
Agree @RichardBarber it was a mistake of mine. Thanks anyways for your help :)Blaise
I
1

The problem is you are trying to run an imagen that does not exists. If you are executing a Dockerfile, the image was not created until Dockerfile pass with no errors; so when Dockerfile tries to run the image, it can't find it. Be sure you have no errors in the execution of your scripts.

Implacable answered 22/4, 2020 at 12:27 Comment(1)
Hey, I think this is not the right answer. The docker image is not public and so this user cannot download the image.Anthelmintic
A
1

The simplest answer can be the correct one!.. make sure you have permissions to execute the command, use:

sudo docker run -p 8080:80 shakyshane/cra-docker

Augment answered 18/10, 2021 at 20:23 Comment(0)
L
1

In my case, I didn't realise there was a difference between docker run and docker start, and I kept using the run command when I should've been using the start command.

FYI, run is for building and creating the docker container, start is to just start a stopped container

Lithography answered 13/12, 2021 at 4:29 Comment(0)
S
0

Use -d

sudo docker run -d -p 8000:8000 rasa/duckling

learn about -d here

sudo docker run --help
Sherrylsherurd answered 10/6, 2022 at 12:20 Comment(0)
R
0

At first, i build image on mac-m1-pro with this command docker build -t hello_k8s_world:0.0.1 ., when is run this image the issue appear.

After read Master Yi's answer, i realize the crux of the matter and rebuild my images like this docker build --platform=arm64 -t hello_k8s_world:0.0.1 .

Finally,it worked.

Rowlock answered 12/8, 2022 at 17:48 Comment(0)
M
0

Since Docker 23.0, docker build has become an alias for docker buildx build.

You might be using a custom builder instance.

Set the builder instance to default with this command and run your build command again.

docker buildx use default
Mosquito answered 12/9, 2023 at 13:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.