简体   繁体   English

使用 GitLab 的私有 Docker-Registry

[英]Private Docker-Registry with GitLab

I want to have a GitLab-Registry ( https://docs.gitlab.com/ee/administration/container_registry.html ).我想要一个 GitLab-Registry ( https://docs.gitlab.com/ee/administration/container_registry.html )。 It is a Docker-Registry and GitLab will handle the Authentication.它是一个 Docker-Registry,GitLab 将处理身份验证。

My problem is that it is not working and I have no idea what to do.我的问题是它不起作用,我不知道该怎么做。

My Registry-Container is started like this:我的 Registry-Container 是这样启动的:

 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):我的 GitLab 配置如下所示(GitLab 不在 Docker-Container 中运行,而是从源代码安装):

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: registry docker 日志返回:

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?我错过了任何部分还是我做错了什么?

The solution to this problem was to set REGISTRY_AUTH_TOKEN_AUTOREDIRECT to false .此问题的解决方案是将REGISTRY_AUTH_TOKEN_AUTOREDIRECT设置为false The registry then returned the correct url.然后注册表返回了正确的 url。

At the moment the REGISTRY_AUTH_TOKEN_AUTOREDIRECT parameter is not documented.目前REGISTRY_AUTH_TOKEN_AUTOREDIRECT参数没有记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM