I have self-hosted a docker registry by following this. But when I try to push any images it fails with a missing content-length
error.
missing content-length header for request: https://registry.filthyweebs.in/v2/test-image/blobs/sha256:b52eb23a552e2c2a580f2adc60e6b3d2c06e23c90323f3abfd4f9ffc3aa464f6
I have created the following docker-compose.yml
version: '3'
services:
registry:
restart: always
image: registry:2
ports:
- "7244:5000"
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry
REGISTRY_AUTH_HTPASSWD_PATH: /auth/registry.password
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
REGISTRY_VALIDATION_DISABLED: true
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/fullchain.pem
REGISTRY_HTTP_TLS_KEY: /certs/privkey.pem
volumes:
- ./auth:/auth
- ./data:/data
- ./certs:/certs
Upon checking the log I found some errors but I still have no clue why they are there
time="2023-08-13T07:11:08.651744609Z" level=error msg="response completed with error" auth.user.name=admin err.code=unknown err.detail="invalid byte in chunk length" err.message="unknown error" go.version=go1.19.9 http.request.host=registry.filthyweebs.in http.request.id=14e4c98d-848b-4398-b0a7-b8d57ec794e0 http.request.method=PATCH http.request.remoteaddr=xxx.xxx.xxx.xxx http.request.uri="/v2/test-image/blobs/uploads/a0fa5af8-211d-445c-902b-5c5d7aadaac4?_state=zkuo-95XSKgz212Hf2nt3ZpOuX-qqzL2ROwU8hyCkVl7Ik5hbWUiOiJ0ZXN0LWltYWdlIiwiVVVJRCI6ImEwZmE1YWY4LTIxMWQtNDQ1Yy05MDJiLTVjNWQ3YWFkYWFjNCIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAyMy0wOC0xM1QwNzoxMTowOC4wODkzNzU4NjFaIn0%3D" http.request.useragent="docker/20.10.25+dfsg1 go/go1.20.7 git-commit/5df983c kernel/6.3.0-kali1-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/20.10.25+dfsg1 \(linux\))" http.response.contenttype="application/json; charset=utf-8" http.response.duration=15.292544ms http.response.status=500 http.response.written=98 vars.name=test-image vars.uuid=a0fa5af8-211d-445c-902b-5c5d7aadaac4
Is there some step or configuration that I am missing? I have tried setting it up twice and both times it is throwing the same error.
The server is hosted on Debian's bookworm distro and the client is using Kali Linux (rolling) with all the latest updates.
The server(Openlitespeed) I was using was at fault. I'm unsure why, but the docker-registry
running behind OLS always fails with content-length
header issues. The simple solution was to use nginx-proxy-manager
.
Also, if someone is trying to self-host a docker registry, be aware of Cloudflare's max upload size.