docker-archive / docker-registry

This is **DEPRECATED**! Please go to https://github.com/docker/distribution
Apache License 2.0
2.88k stars 877 forks source link

FATA[0000] Error: v1 ping attempt failed with error: Get http://localhost:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused #1006

Closed eaoliver closed 9 years ago

eaoliver commented 9 years ago

For weeks I have been running a Docker registry:latest on a private server on AWS. I access it via an SSH tunnel listening on port 5000 and forwarding to localhost:5000 on the server running the Docker registry.

I'm still able to search the registry, and it returns the correct results.

curl -XGET localhost:5000/v1/search {"num_results": 1, "query": "", "results": [{"description": null, "name": "library/debian"}]}

However, I am unable to push or pull images from the registry. Any push or pull request returns:

FATA[0000] Error: v1 ping attempt failed with error: Get http://localhost:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused

That's it... no additional info.

eaoliver commented 9 years ago

I should add that a curl of the v1/_ping does work. Returns an empty object.

curl -XGET localhost:5000/v1/_ping {}

dmp42 commented 9 years ago

@eaoliver where does you docker daemon live? Is it on the same host from where you are running your curl command? Or is it inside a VM? (eg: boot2docker)

Also, can you provide a copy of your docker daemon logs, preferably ran in debug mode? (-D)

Thanks.

eaoliver commented 9 years ago

I am running Docker version 1.6.2, build 7c8fca2 on boot2docker on a Mac.

Following is the output from docker.log for:

docker push localhost:5000/debian

time="2015-05-23T00:38:35Z" level=debug msg="Calling POST /images/{name:._}/push" time="2015-05-23T00:38:35Z" level=info msg="POST /v1.18/images/localhost:5000/debian/push?tag=" time="2015-05-23T00:38:35Z" level=info msg="+job push(localhost:5000/debian)" time="2015-05-23T00:38:35Z" level=info msg="+job resolve_repository(localhost:5000/debian)" time="2015-05-23T00:38:35Z" level=info msg="-job resolve_repository(localhost:5000/debian) = OK (0)" time="2015-05-23T00:38:35Z" level=debug msg="pinging registry endpoint https://localhost:5000/v0/" time="2015-05-23T00:38:35Z" level=debug msg="attempting v2 ping for registry endpoint https://localhost:5000/v2/" time="2015-05-23T00:38:35Z" level=debug msg="https://localhost:5000/v2/ -- HEADERS: map[User-Agent:[docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64]]" time="2015-05-23T00:38:35Z" level=debug msg="attempting v1 ping for registry endpoint https://localhost:5000/v1/" time="2015-05-23T00:38:35Z" level=debug msg="https://localhost:5000/v1/_ping -- HEADERS: map[User-Agent:[docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64]]" time="2015-05-23T00:38:35Z" level=debug msg="Error from registry \"https://localhost:5000/v0/\" marked as insecure: unable to ping registry endpoint https://localhost:5000/v0/\nv2 ping attempt failed with error: Get https://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connection refused\n v1 ping attempt failed with error: Get https://localhost:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused. Insecurely falling back to HTTP" time="2015-05-23T00:38:35Z" level=debug msg="attempting v2 ping for registry endpoint http://localhost:5000/v2/" time="2015-05-23T00:38:35Z" level=debug msg="http://localhost:5000/v2/ -- HEADERS: map[User-Agent:[docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64]]" time="2015-05-23T00:38:35Z" level=debug msg="attempting v1 ping for registry endpoint http://localhost:5000/v1/" time="2015-05-23T00:38:35Z" level=debug msg="http://localhost:5000/v1/_ping -- HEADERS: map[User-Agent:[docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64]]" invalid registry endpoint "http://localhost:5000/v0/". HTTPS attempt: unable to ping registry endpoint https://localhost:5000/v0/ v2 ping attempt failed with error: Get https://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connection refused v1 ping attempt failed with error: Get https://localhost:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused. HTTP attempt: unable to ping registry endpoint http://localhost:5000/v0/ v2 ping attempt failed with error: Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connection refused v1 ping attempt failed with error: Get http://localhost:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused time="2015-05-23T00:38:35Z" level=info msg="-job push(localhost:5000/debian) = ERR (1)" time="2015-05-23T00:38:35Z" level=error msg="Handler for POST /images/{name:._}/push returned error: v1 ping attempt failed with error: Get http://localhost:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused" time="2015-05-23T00:38:35Z" level=error msg="HTTP Error: statusCode=500 v1 ping attempt failed with error: Get http://localhost:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused"

Now that I see the log, I can confirm that 127.0.0.1 is not accessible from within the boot2docker.

docker@boot2docker:/var/log$ curl -XGET http://localhost:5000/v1/search curl: (7) Failed connect to localhost:5000; Connection refused

The boot2docker routing table seems to be correct too:

docker@boot2docker:/var/log$ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 10.0.2.2 0.0.0.0 UG 1 0 0 eth0 10.0.2.0 * 255.255.255.0 U 0 0 0 eth0 127.0.0.1 * 255.255.255.255 UH 0 0 0 lo 172.17.0.0 * 255.255.0.0 U 0 0 0 docker0 192.168.59.0 * 255.255.255.0 U 0 0 0 eth1

Since this is not an issue with the registry, closing.

dmp42 commented 9 years ago

@eaoliver let me know if I can help you debug this on irc (#docker-distribution)

FWIW I recommend you move to Docker Machine instead of b2d.

eaoliver commented 9 years ago

@dmp42 Thanks.

funkytaco commented 8 years ago

Why move the thread to IRC... now we have no idea what the fix was

dmp42 commented 8 years ago

@funkytaco moving to irc because github issues are not a proper forum for fast paced discussions about mis-configuration (slow answers, and lots of back and forth).

Furthermore, this here was not an issue, but rather a misconfiguration IIRC.

Finally, I strongly recommend to look into https://github.com/docker/distribution instead (registry:2) since the python registry here is now deprecated.

funkytaco commented 8 years ago

@dmp42 Thanks. I've asked on Gitter and IRC, and while people were helpful, I've had no luck there.

I am using registry:2, but I'm confused as to where to put --insecure-registry 0.0.0.0:5000 (my OSX laptop, The remote Docker host on Centos 7, or the registry:2 Docker container on Ubuntu)... so it accepts my self-signed SSL certificate.

dmp42 commented 8 years ago

@funkytaco https://github.com/docker/distribution/blob/master/docs/insecure.md#using-self-signed-certificates

Every docker daemon that wants to pull or push to this registry will have to be configured that way.

funkytaco commented 8 years ago
ls /etc/docker/certs.d
ls: cannot access /etc/docker/certs.d: No such file or directory
[root@myhost tls]# cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core) 

/etc/docker exists, though.

dmp42 commented 8 years ago

@funkytaco so create the folder