Docker Community Forums

Share and learn in the Docker community.

Private Docker-Registry with GitLab


Hi, I want to have a GitLab-Registry ( 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_AUTH_TOKEN_REALM=https://gitlab.***.com/jwt/auth \
 -e REGISTRY_AUTH_TOKEN_SERVICE=container_registry \
 -e REGISTRY_AUTH_TOKEN_ISSUER=gitlab-issuer \
 -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):

    enabled: true
    host: registry.***.com
    port: 443
    api_url: https://registry.***.com/ 
    cert: /home/git/gitlab/ssl/
    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?

(Vladkras) #2

In my case it was REGISTRY_AUTH_TOKEN_AUTOREDIRECT=true fault. Somehow it’s not mentioned in registry configuration but it’s required. So I just changed it to false and registry started to use REGISTRY_AUTH_TOKEN_REALM url instead of own /auth/token