run-docker.sh hits error on ubuntu "Unable to find image 'localhost/searchfox:latest' locally"
Categories
(Webtools :: Searchfox, defect)
Tracking
(Not tracked)
People
(Reporter: arai, Unassigned)
Details
Attachments
(1 file)
Clean run with ./build-docker.sh
+ ./run-docker.sh
hits the following error (I added set -x
to run-docker.h
) on ubuntu.
looks like the localhost
part is added by https://github.com/mozsearch/mozsearch/pull/842 as a fix for nix support, and reverting it works here.
+ CONTAINER_NAME=searchfox
+ IMAGE_NAME=localhost/searchfox
+ VOLUME_NAME=searchfox-vol
++ pwd
+ THIS_DIR=/home/arai/projects/_mozsearch
+ INSIDE_CONTAINER_DIR=/vagrant
+ OUTSIDE_CONTAINER_PORT=16995
+ INSIDE_CONTAINER_PORT=80
+ SHELL=bash
+ container_exists
+ docker container inspect searchfox
+ LINKMOUNTS=()
+ read -r link
++ find trees -type l
+ VOLMOUNTS=()
+ volume_exists
+ docker volume inspect searchfox-vol
+ VOLMOUNTS+=(--mount type=volume,source=${VOLUME_NAME},target=/home/vagrant)
+ docker run --platform linux/amd64 -it --name searchfox --mount type=bind,source=/home/arai/projects/_mozsearch,target=/vagrant --mount type=volume,source=searchfox-vol,target=/home/vagrant -p 16995:80 localhost/searchfox bash
Unable to find image 'localhost/searchfox:latest' locally
docker: Error response from daemon: Get "http://localhost/v2/": dial tcp 127.0.0.1:80: connect: connection refused.
See 'docker run --help'.
Comment 1•14 days ago
•
|
||
Is it possible the image didn't actually get created? Like, do you see searchfox
if you run docker image list
?
What I understand (now slightly better that before) to be happening here is:
- The thing before the slash is the registry to check if we don't have the image to pull it down from some server where it might exist.
- According to the docs for the docker pull policy if we pass
--pull=never
we can stop it from talking to registries. The default is--pull=missing
which tries to talk to the registry if it can't find the image.- It does seem like podman has the same flag with the same semantics. (That's via the comments Nicolas added to run-docker which also helpfully includes this page on image tags.)
- Maybe we can't find the image so we go to pull, and we try to connect to an HTTP server on localhost, which you don't have.
So it does seem like adding localhost/ to the prefix is probably not actually what we want after all, but we definitely want to do something to stop us from potentially pulling random stuff from the internet. So --pull=never
may be the best option if we can't find another one.
If podman is actually running a registry on localhost, maybe we need to do something more clever with the shell script to differentiate? (Does nix help?)
Reporter | ||
Comment 2•14 days ago
|
||
The image was created. the following is the output when the error above happened:
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
searchfox latest 707af073871f About an hour ago 15.7GB
ubuntu 24.04 b1d9df8ab815 2 months ago 78.1MB
Reverting the localhost
patch works.
So I suppose at least branching on the environment would also work.
I'll test with --pull=never
.
Comment 3•14 days ago
|
||
So a confusing thing is I don't have any problem with the "localhost/"-prefixed image on my Ubuntu 24.10 machine using docker.io package version 26.1.3-0ubuntu1.1 or on my Ubuntu 24.04 laptop using 26.1.3-0ubuntu1~24.04.1. But I think I might have had a problem on the 24.04 laptop initially but then I think I did something and the problem went away. I don't remember exactly what I did, but I think I might have removed the "localhost/", invoked ./run-docker.sh
, then later reverted the localhost/ change and it was happy again. I'm not running web-servers on port 80 on either machine and my /etc/hosts localhost entry is 127.0.0.1.
Comment 4•12 days ago
|
||
tl;dr: We should probably revert the change to localhost and then it can be a follow-up to make podman happy. I think this won't break CI (when it lands) because CI sidesteps use of docker and just runs on the bare VM?
As an additional data point, I just upgraded my laptop to Ubuntu 24.10 and ran ./build-docker.sh
and experienced the same error from comment 0.
I then:
- removed the "localhost/" piece from
run-docker.sh
- ran
./run-docker.sh
which worked - restored the state of the
run-docker.sh
script via "git checkout run-docker.sh" so "localhost/" was present again - ran
./run-docker.sh
again, which worked despite the presence of "localhost/"
I then:
- ran
./build-docker.sh
again (which ran very quickly with the caching) - ran
./run-docker.sh
again with "localhost/" in place, and this failed again. - added
--pull=never
to thedocker run
invocation - ran
./run-docker.sh
again and got the errordocker: Error response from daemon: No such image: localhost/searchfox:latest
- It seems like this raises the fundamental question of whether podman is actually creating an image with repository
localhost/searchfox
and taglatest
or if it is also creating an image with repositorysearchfox
and taglatest
.
- It seems like this raises the fundamental question of whether podman is actually creating an image with repository
- removed the "localhost/" line again
- ran
./run-docker.sh
again with no "localhost/" but with the--pull=never
in place. This worked.
I should note that once we have successfully invoked docker run
once, the run-docker.sh
script takes the if container_exists
branch which invokes docker container start
which doesn't consider the need to update an image. I suppose this raises the question of whether maybe we should be invoking docker container create instead of using docker run
(which is really docker container run)... but it seems like the situation is probably identical for docker container create
, as it also takes --pull
, etc.
Reporter | ||
Comment 5•11 days ago
|
||
Reporter | ||
Updated•11 days ago
|
Description
•