benbot
benbot

Reputation: 1245

I keep getting a 404 error when trying to push to my private repository. Why?

I made a registry exactly how it says in the docker documentation and for some reason whenever I try pushing an image to it, it throws a 404 error at me.

here is the error Error: Status 404 trying to push repository stelasite: "404 page not found\n"

and on the server side, this 11/8/2015 6:33:00 PM173.12.71.226 - - [08/Nov/2015:23:33:00 +0000] "GET /v2/ HTTP/1.1" 401 87 "" "docker/1.8.2-fc22 go/go1.5.1 kernel/4.2.3-200.fc22.x86_64 os/linux arch/amd64" 11/8/2015 6:33:05 PM173.12.71.226 - - [08/Nov/2015:23:33:05 +0000] "PUT /v1/repositories/stelasite/ HTTP/1.1" 404 19 "" "docker/1.8.2-fc22 go/go1.5.1 kernel/4.2.3-200.fc22.x86_64 os/linux arch/amd64"

Does anyone have any idea what's going on? Apparently it can't connect to the v1 api but I don't know why the docker cli would even try that.

Upvotes: 4

Views: 8519

Answers (2)

Mike Placentra
Mike Placentra

Reputation: 885

I had the same issue, and solved it by getting my local docker environment in order.

The cause of my issue was either that my Docker client was too old, or that I had a mismatch in docker version between my Docker client (1.7.1) and docker-machine VM (1.8.1). I had a version mismatch because I created the VM and then downgraded my docker client. The access logs on the registry said the client was 1.8.1 even though my host system had 1.7.1. I deleted the docker-machine VM (docker-machine rm <environment name>), then uninstalled docker and re-installed 1.10.0 via Homebrew.

If you're running multiple Docker registries behind a load balancer, another thing that might cause problems with pushing is a mismatch in HTTP secrets. You'd need to explicitly set them all to the same thing using either the environment variable REGISTRY_HTTP_SECRET or like this in the config file:

http:
    secret: mysecret

I saw a blog post from 2013 that claimed the secret needs to be 64 characters long, but I don't see that in the docs

Upvotes: 1

cristi
cristi

Reputation: 2209

I had the same error when the registry machine was responding very slow. In my case it was a issue with one of the dns servers.

Changing the dns server, made push work again. You can test it by pinging the distribution server and see if it's very slow to respond or resolve the hostname.

If you run docker with --debug, this is the output from logs:

DEBU[0013] Calling POST /images/{name:.*}/push
INFO[0013] POST /v1.20/images/docker-distribution.company.net:5000/nginx/push?tag=
DEBU[0023] hostDir: /etc/docker/certs.d/docker-distribution.company.net:5000
DEBU[0033] Trying to push docker-distribution.company.net:5000/nginx to https://docker-distribution.company.net:5000 v2
DEBU[0038] Error getting v2 registry: Get https://docker-distribution.company.net:5000/v2/: net/http: request canceled while waiting for connection
DEBU[0038] Trying to push docker-distribution.company.net:5000/nginx to https://docker-distribution.company.net:5000 v1
DEBU[0038] hostDir: /etc/docker/certs.d/docker-distribution.company.net:5000
DEBU[0038] attempting v2 ping for registry endpoint https://docker-distribution.company.net:5000/v2/
DEBU[0043] Endpoint https://docker-distribution.company.net:5000/v2/ is eligible for private registry. Enabling decorator.

You can see that the error is "request canceled while waiting for connection".

Upvotes: 0

Related Questions