Unable to find image locally error on Linux

I’ve been using Docker and Docker Desktop on Windows for a couple of months, but I feel I’m still very new to this. Yesterday I installed Linux on my machine (KDE Neon) and installed Docker and Docker-compose along with it.

One of the docker images I sometimes use to test a php project is this one: mattrayner/lamp. On Windows, I just type in the following command in order to create a persistent app and mysql folder:

docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest

However, now that I’m on Linux I get the following error:

Unable to find image 'code:latest' locally
docker: Error response from daemon: pull access denied for code, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

But the image does exist (it works on Windows) and does not require ‘docker login’.
It looks like it has something to do with the app and mysql params that are passed to the -v arguments, because the command does work without them (but then I don’t have the app and mysql folders on my system).

Can someone help me out here? Is there some syntax difference between Linux and Windows commands?

If your ${PWD} has space characters, you will need to quote the -v argmuments like this:

docker run -i -t -p "80:80" -v "${PWD}/app:/app" -v "${PWD}/mysql:/var/lib/mysql" mattrayner/lamp:latest

If a command uses a variable with spaces, it will be expanded to multiple strings (1+number of spaces). If quoted the variable value will be treated as a single string, regardless of the spaces.

1 Like

Thanks, I’ll try this.

However, I am a bit confused… There aren’t any spaces within that param. So why should this be a problem here?
Or do you mean the variable ${PWD} is containing spaces?

Edit: this solution worked!

yep, the value of the variable.

1 Like

I am dealing with a similar issue. Can you break down the error message? What is ‘docker run’ looking for first? The Dockerfile? What makes it look for the :latest (as listed in the second section below)?

When I first ran docker build (docker build -t lnbits .) it gave me a warning:

WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load

I ignored it thinking this was not fatal, just telling me the data is in memory to be used later.

I ran the docker run command and it fails with this posts error:

Unable to find image ‘lnbits:latest’ locally
docker: Error response from daemon: pull access denied for lnbits, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied.
See ‘docker run --help’.

Then when I saw this post, I added the " " although I didn’t have spaces in $PWD.

docker run --detach --publish "5000:5000" --name lnbits --volume "${PWD}/.env:/app/.env" --volume "${PWD}/data/:/app/data" lnbits`

This is the contents of lnbits folder:

~/lnbits$ ls
app.json    docs     Makefile      package-lock.json  pytest.ini        tests
data        LICENSE  mypy.ini      Pipfile            README.md
Dockerfile  lnbits   package.json  Procfile           requirements.txt

The lnbits listed here is a folder with python files in it.
I appreciate your response!

In case you want to see the results of the ‘docker run’:

docker build -t lnbits .
WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load 
[+] Building 3.8s (16/16) FINISHED                                                      
 => [internal] load build definition from Dockerfile                               0.6s
 => => transferring dockerfile: 1.14kB                                             0.2s
 => [internal] load .dockerignore                                                  0.5s
 => => transferring context: 2B                                                    0.1s
 => [internal] load metadata for removedforforumrules/library/python:3.7-slim                 2.1s
 => [lnbits 1/4] FROM removedforforumrules/library/python:3.7-slim@sha256:c2cc09c3de140f59b3  0.4s
 => => resolve removedforforumrules/library/python:3.7-slim@sha256:c2cc09c3de140f59b3065b951  0.3s
 => [internal] load build context                                                  0.7s
 => => transferring context: 32.35kB                                               0.4s
 => CACHED [builder 2/9] RUN python -m venv /opt/venv                              0.0s
 => CACHED [builder 3/9] RUN apt-get update                                        0.0s
 => CACHED [builder 4/9] RUN apt-get install -y --no-install-recommends build-ess  0.0s
 => CACHED [builder 5/9] COPY requirements.txt /tmp/requirements.txt               0.0s
 => CACHED [builder 6/9] RUN python -m pip install --upgrade pip                   0.0s
 => CACHED [builder 7/9] RUN pip install -r /tmp/requirements.txt                  0.0s
 => CACHED [builder 8/9] RUN pip install pylightning                               0.0s
 => CACHED [builder 9/9] RUN pip install lndgrpc                                   0.0s
 => CACHED [lnbits 2/4] COPY --from=builder --chown=1000:1000 /opt/venv /opt/venv  0.0s
 => CACHED [lnbits 3/4] WORKDIR /app                                               0.0s
 => CACHED [lnbits 4/4] COPY --chown=1000:1000 lnbits /app/lnbits                  0.0s

This is not docker run, this is docker build. And it looks like it failed so there is no inbits tag. Are you sure you inserted the entire output?

just to clarify I mixed up the postings above - you’ll see two entries - a docker run and a docker build - out of order above. I see I also wrote run/build interchangeably above.
I didn’t realize the docker build failed until the docker run failed because I thought the docker build warning wasn’t fatal (noob here).

dme1sc@dme1sc:~/lnbits$ docker build -t lnbits .
WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load 
[+] Building 28.5s (16/16) FINISHED                                                     
 => [internal] load build definition from Dockerfile                               1.2s
 => => transferring dockerfile: 1.15kB                                             0.0s
 => [internal] load .dockerignore                                                  1.3s
 => => transferring context: 2B                                                    0.0s
 => [internal] load metadata for docker.io/library/python:3.7-slim                 1.6s
 => CACHED [builder 1/9] FROM docker.io/library/python:3.7-slim@sha256:c2cc09c3de  0.0s
 => => resolve removedforforumrules/library/python:3.7-slim@sha256:c2cc09c3de140f59b3065b951  0.4s
 => [internal] load build context                                                  1.1s
 => => transferring context: 9.75MB                                                0.8s
 => CACHED [builder 2/9] RUN python -m venv /opt/venv                              0.0s
 => CACHED [builder 3/9] RUN apt-get update                                        0.0s
 => CACHED [builder 4/9] RUN apt-get install -y --no-install-recommends build-ess  0.0s
 => CACHED [builder 5/9] COPY requirements.txt /tmp/requirements.txt               0.0s
 => CACHED [builder 6/9] RUN python -m pip install --upgrade pip                   0.0s
 => CACHED [builder 7/9] RUN pip install -r /tmp/requirements.txt                  0.0s
 => CACHED [builder 8/9] RUN pip install pylightning                               0.0s
 => [builder 9/9] RUN pip install lndgrpc purerpc                                 15.5s
 => [lnbits 2/4] COPY --from=builder --chown=1000:1000 /opt/venv /opt/venv         2.8s 
 => [lnbits 3/4] WORKDIR /app                                                      1.2s 
 => [lnbits 4/4] COPY --chown=1000:1000 lnbits /app/lnbits                         1.6s 
dme1sc@dme1sc:~/lnbits$

No problem :slight_smile: It happens.

To tell you the truth I don’t exactly know what that warning is. Buildkit is very powerful tool which is very good at ruining the build… I really liked it, but there is so much problem with it recently. I can’t believe it became so popular.

If your Dockerfile support building without buildkit, then try this to at least get another error message:

DOCKER_BUILDKIT=0 docker build -t Inbits .

I edited your comment to use the </> button to highlight the code and the comment disappeared :open_mouth: This is my first edit, I don’t know what happened, sorry

dme1sc@dme1sc:~/lnbits$ DOCKER_BUILDKIT=0 docker build -t lnbits .
WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 3.7s (16/16) FINISHED
=> [internal] load .dockerignore 0.5s
=> => transferring context: 2B 0.1s
=> [internal] load build definition from Dockerfile 0.6s
=> => transferring dockerfile: 1.15kB 0.2s
=> [internal] load metadata for dockerio/library/python:3.7-slim 2.2s
=> [internal] load build context 0.7s
=> => transferring context: 32.35kB 0.4s
=> [builder 1/9] FROM dockerio/library/python:3.7-slim@sha256:c2cc09c3de140f59b 0.3s
=> => resolve dockerio/library/python:3.7-slim@sha256:c2cc09c3de140f59b3065b951 0.3s
=> CACHED [builder 2/9] RUN python -m venv /opt/venv 0.0s
=> CACHED [builder 3/9] RUN apt-get update 0.0s
=> CACHED [builder 4/9] RUN apt-get install -y --no-install-recommends build-ess 0.0s
=> CACHED [builder 5/9] COPY requirements.txt /tmp/requirements.txt 0.0s
=> CACHED [builder 6/9] RUN python -m pip install --upgrade pip 0.0s
=> CACHED [builder 7/9] RUN pip install -r /tmp/requirements.txt 0.0s
=> CACHED [builder 8/9] RUN pip install pylightning 0.0s
=> CACHED [builder 9/9] RUN pip install lndgrpc purerpc 0.0s
=> CACHED [lnbits 2/4] COPY --from=builder --chown=1000:1000 /opt/venv /opt/venv 0.0s
=> CACHED [lnbits 3/4] WORKDIR /app 0.0s
=> CACHED [lnbits 4/4] COPY --chown=1000:1000 lnbits /app/lnbits 0.0s
dme1sc@dme1sc:~/lnbits$

May I suggest to actualy try what the warning tells you?

docker build -t lnbits --load .

I must admit, I have never seen this warning before and am currious about the output of docker version

I don’t want to highjack this thread, but I am kind of currious what kind of problems, as it works like a charm for me.

2 Likes

Actualy the warning and the suggested solution is from the docker builderx build context.

Can you share the ouput of docker build --help and docker buildx build --help.

These are misterious issues. I haven’t really had a problem personally but I helped others who had. There were many issue here on the forum I couldn’t explain and at the end, the solution was disabling buildkit. There was one case a year ago or so, when someone had a problem with the volume autoremoval. It was so complex and strange error, I almost failed to find the cause. I tried to reproduce the error but couldn’t. Only with one image. The one, the user used who asked for help. It turned out that image was built with buildkit and it changed how it worked. I don’t remember the exact problem but that shouldn’t happen. It wasn’t the build process when the problem ocured, but it affected the it could be used later.

Thanks for sharing! I must admit personaly I have nothing but good experience with buildkit. I can see how troubleshooting problems related to buildkit itself would be a challenge.

Wow - you guys are awesome!
docker build -t lnbits --load .
This worked. I had tried the --load but I was putting it after BUILD. I didn’t even think about putting it after ‘lnbits’.
It ran successfully.

me1sc@dme1sc:~/lnbits$ docker version
Client: Docker Engine - Community
Version: 20.10.10
API version: 1.41
Go version: go1.16.9
Git commit: b485636
Built: Mon Oct 25 07:42:59 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.10
API version: 1.41 (minimum version 1.12)
Go version: go1.16.9
Git commit: e2f740d
Built: Mon Oct 25 07:41:08 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.11
GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0