docker-registry
docker-registry copied to clipboard
Working with Local Registry and Docker Machine
I have create a local registry at localhost:8950 (5000 was in use). I can push and pull images to it without issue. However, once I spin up a VirtualBox VM with Docker Machine, and switch to that environment, I can no longer pull images from the repository. Is the expectation that these two applications work together? The localhost, single host scenario is the simplest test case I could create. Assuming repository is still considered 'local' to Docker Machine VM?
From with the Docker-Machine environment, when I run my docker-compose up command, I get:
gstafford@gstafford-X555LA:~/NetBeansProjects/virtual-vehicles-docker$ docker-compose -p jenkins up -d --x-smart-recreate
Building mongovalet...
Step 0 : FROM localhost:8950/mongo:latest
Service 'mongovalet' failed to build: invalid registry endpoint "http://localhost:8950/v0/". HTTPS attempt: unable to ping registry endpoint https://localhost:8950/v0/
v2 ping attempt failed with error: Get https://localhost:8950/v2/: dial tcp 127.0.0.1:8950: connection refused
v1 ping attempt failed with error: Get https://localhost:8950/v1/_ping: dial tcp 127.0.0.1:8950: connection refused. HTTP attempt: unable to ping registry endpoint http://localhost:8950/v0/
v2 ping attempt failed with error: Get http://localhost:8950/v2/: dial tcp 127.0.0.1:8950: connection refused
v1 ping attempt failed with error: Get http://localhost:8950/v1/_ping: dial tcp 127.0.0.1:8950: connection refused
Even a direct docker pull commands get an error:
gstafford@gstafford-X555LA:~/NetBeansProjects/virtual-vehicles-docker$ docker pull localhost:8950/mongo
Error response from daemon: invalid registry endpoint "http://localhost:8950/v0/". HTTPS attempt: unable to ping registry endpoint https://localhost:8950/v0/
v2 ping attempt failed with error: Get https://localhost:8950/v2/: dial tcp 127.0.0.1:8950: connection refused
v1 ping attempt failed with error: Get https://localhost:8950/v1/_ping: dial tcp 127.0.0.1:8950: connection refused. HTTP attempt: unable to ping registry endpoint http://localhost:8950/v0/
v2 ping attempt failed with error: Get http://localhost:8950/v2/: dial tcp 127.0.0.1:8950: connection refused
v1 ping attempt failed with error: Get http://localhost:8950/v1/_ping: dial tcp 127.0.0.1:8950: connection refused
I have confirmed it works locally, outside the docker machine environments, by pulling and pushing images. The container is running fine:
gstafford@gstafford-X555LA:~/NetBeansProjects/virtual-vehicles-docker$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
590b5c060a85 registry:2 "registry cmd/regist 15 hours ago Up 14 hours 0.0.0.0:8950->5000/tcp registry
+1. docker registry push/pull also works locally for me but when deployed on ECS I'm seeing the same error. I'm tunneling in though ssh so the push/pull is still to localhost, but just to be safe I'm using --insecure-registry localhost:5000 in my boot2docker docker config. other docker containers on the same server can send and receive network requests through a similar ssh pipe so it seems like it's not a connectivity issue. any advice would be appreciated
@garystafford the VM is a different host. You cannot expect "localhost" from machine A to be "localhost" for machine B. So, if you start your registry on machine A, with ip X.Y.Z.W, use X.Y.Z.W instead of localhost to pull images from.
@evanbeard same thing, likely. Expecting localhost to resolve to a remote machine is unrealistic.
Hope that helps.