Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Private Docker-Registry with GitLab

I want to have a GitLab-Registry (https://docs.gitlab.com/ee/administration/container_registry.html). It is a Docker-Registry and GitLab will handle the Authentication.

My problem is that it is not working and I have no idea what to do.

My Registry-Container is started like this:

 sudo docker run -d \
 -e REGISTRY_LOG_LEVEL=debug \
 -e REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/registry \
 -e REGISTRY_AUTH_TOKEN_REALM=https://gitlab.***.com/jwt/auth \
 -e REGISTRY_AUTH_TOKEN_SERVICE=container_registry \
 -e REGISTRY_AUTH_TOKEN_ISSUER=gitlab-issuer \
 -e REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/root/certs/registry.pub \
 -e REGISTRY_AUTH_TOKEN_AUTOREDIRECT=true \
 -v /home/git/gitlab/ssl/:/root/certs/ \
 -p 5000:5000 --name registry registry:2

My Configuration of GitLab looks like this (GitLab is not running in a Docker-Container and it is installed from source):

registry:
    enabled: true
    host: registry.***.com
    port: 443
    api_url: https://registry.***.com/ 
    cert: /home/git/gitlab/ssl/registry.pub
    key: /home/git/gitlab/ssl/registry.priv
    #path: /path/data
    issuer: gitlab-issuer

When I want to login with

docker login registry.***.com:443

it returns following:

Error response from daemon: Get https://registry.***.com/v2/: error parsing HTTP 404 response body: invalid character 'p' after top-level     value: "404 page not found\n"

docker logs of registry returns:

GET /auth/token?    account=****&client_id=docker&offline_token=true&service=container_registry HTTP/1.0 404

Did I miss any part or what did I wrong?

like image 985
Lee Avatar asked May 30 '26 12:05

Lee


1 Answers

The solution to this problem was to set REGISTRY_AUTH_TOKEN_AUTOREDIRECT to false. The registry then returned the correct url.

At the moment the REGISTRY_AUTH_TOKEN_AUTOREDIRECT parameter is not documented.

like image 58
Lee Avatar answered Jun 01 '26 17:06

Lee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!