Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find docker image locally

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?

like image 656
xameeramir Avatar asked Jun 09 '19 07:06

xameeramir


People also ask

Where are docker images located locally?

The docker images, they are stored inside the docker directory: /var/lib/docker/ images are stored there.

How do I run a docker image locally in Windows?

Select the image you want to run, and click Run. On the Run menu, set up the configuration for the container, such as the container name, the isolation type, which ports to publish, and memory and CPU allocation. Additionally, you can append Docker run commands that are not in the UI, such as -v for persistent volume.


4 Answers

Well this is anti-logical but still sharing so future people like me don't get stuck

So 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
like image 57
xameeramir Avatar answered Oct 19 '22 19:10

xameeramir


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

like image 32
Ninad Pingale Avatar answered Oct 19 '22 19:10

Ninad Pingale


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.

like image 12
Master Yi Avatar answered Oct 19 '22 20:10

Master Yi


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
like image 7
Leila Talebzadeh Avatar answered Oct 19 '22 21:10

Leila Talebzadeh