docker - 将gitlab设置为docker容器,并显示docker Registry错误500

标签 docker gitlab docker-compose docker-registry

我正在尝试在Vagrant框中运行Gitlab docker 容器。
但是我在运行Docker注册表时遇到一些问题。

我的docker-compose.yml

gitlab:
  container_name: gitlab
  image: gitlab/gitlab-ce:latest
  volumes:
  - /srv/gitlab/config:/etc/gitlab
  - /srv/gitlab/logs:/var/log/gitlab 
  - /srv/gitlab/data:/var/opt/gitlab
  - /srv/gitlab/logs/reconfigure:/var/log/gitlab/reconfigure
  restart: always
  hostname: 192.168.7.7
  ports:
    - 0.0.0.0:23:22
    - 0.0.0.0:80:80
    - 0.0.0.0:443:443
    - 0.0.0.0:5000:5000
    - 0.0.0.0:7443:7443

(端口23:22仅仅是因为我在一个无聊的盒子中启动它,并且该端口已被使用)
gitlab本身以后可以在ip下使用:192.168.7.7
要激活docker-registry,我将/srv/gitlab/config/gitlab.rb更改为以下内容:
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "192.168.7.7"
gitlab_rails['registry_port'] = "7443"
gitlab_rails['registry_api_url'] = "http://192.168.7.7:5000"

在完成新的docker-compose之后,即可使用container-registry,但是单击按钮会将我发送到显示500错误页面的URL
http://192.168.7.7/mygroup/myproject/container_registry
并带有以下错误日志:
gitlab    | 
gitlab    | ==> /var/log/gitlab/gitlab-rails/production.log <==
gitlab    | Started GET "/mygroup/myproject/container_registry" for 127.0.0.1 at 2016-06-20 14:29:06 +0000
gitlab    | Processing by Projects::ContainerRegistryController#index as HTML
gitlab    |   Parameters: {"namespace_id"=>"plattform", "project_id"=>"node-sample"}
gitlab    | Completed 500 Internal Server Error in 858ms (ActiveRecord: 29.6ms)
gitlab    | 
gitlab    | Faraday::ConnectionFailed (Connection reset by peer):
gitlab    |   lib/container_registry/client.rb:18:in `repository_tags'
gitlab    |   lib/container_registry/repository.rb:22:in `manifest'
gitlab    |   lib/container_registry/repository.rb:31:in `tags'
gitlab    |   app/controllers/projects/container_registry_controller.rb:8:in `index'
gitlab    |   lib/gitlab/middleware/go.rb:16:in `call'
gitlab    | 
gitlab    | 
gitlab    | 
gitlab    | ==> /var/log/gitlab/gitlab-workhorse/current <==
gitlab    | 2016-06-20_14:29:07.96418 2016/06/20 14:29:07 ErrorPage: serving predefined error page: 500
gitlab    | 
gitlab    | ==> /var/log/gitlab/nginx/gitlab_access.log <==
gitlab    | 192.168.7.1 - - [20/Jun/2016:14:29:07 +0000] "GET /mygroup/myproject/container_registry HTTP/1.1" 500 2205 "http://192.168.7.7/mygroup/myproject" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
gitlab    | 
gitlab    | ==> /var/log/gitlab/gitlab-workhorse/current <==
gitlab    | 2016-06-20_14:29:07.96500 192.168.7.7 @ - - [2016-06-20 14:29:06.832069994 +0000 UTC] "GET /mygroup/myproject/container_registry HTTP/1.1" 500 2205 "http://192.168.7.7/mygroup/myproject" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0" 1.132525
gitlab    | 
gitlab    | ==> /var/log/gitlab/gitlab-rails/production.log <==
gitlab    | Started GET "/mygroup/myproject/container_registry" for 127.0.0.1 at 2016-06-20 14:29:07 +0000
gitlab    | Processing by Projects::ContainerRegistryController#index as HTML
gitlab    |   Parameters: {"namespace_id"=>"plattform", "project_id"=>"node-sample"}
gitlab    | Completed 500 Internal Server Error in 98ms (ActiveRecord: 10.6ms)
gitlab    | 
gitlab    | Faraday::ConnectionFailed (Connection reset by peer):
gitlab    |   lib/container_registry/client.rb:18:in `repository_tags'
gitlab    |   lib/container_registry/repository.rb:22:in `manifest'
gitlab    |   lib/container_registry/repository.rb:31:in `tags'
gitlab    |   app/controllers/projects/container_registry_controller.rb:8:in `index'
gitlab    |   lib/gitlab/middleware/go.rb:16:in `call'
gitlab    | 
gitlab    | 
gitlab    | 
gitlab    | ==> /var/log/gitlab/gitlab-workhorse/current <==
gitlab    | 2016-06-20_14:29:08.13700 2016/06/20 14:29:08 ErrorPage: serving predefined error page: 500
gitlab    | 2016-06-20_14:29:08.13719 192.168.7.7 @ - - [2016-06-20 14:29:07.985360314 +0000 UTC] "GET /mygroup/myproject/container_registry HTTP/1.1" 500 2205 "http://192.168.7.7/mygroup/myproject" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0" 0.151699
gitlab    | 
gitlab    | ==> /var/log/gitlab/nginx/gitlab_access.log <==
gitlab    | 192.168.7.1 - - [20/Jun/2016:14:29:08 +0000] "GET /mygroup/myproject/container_registry HTTP/1.1" 500 2205 "http://192.168.7.7/mygroup/myproject" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"

有人知道这个问题吗?

最佳答案

实际的注册表未包含在Gitlab中,它仅用作身份验证服务。
您将需要为注册表设置一个单独的容器:

gitlab:
  [...]

registry:
  image: registry:2
  [...]

关于docker - 将gitlab设置为docker容器,并显示docker Registry错误500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37925220/

相关文章:

docker - 每个 docker 容器在运行时运行一个单独的 JVM?

docker - 将Windows共享安装到Kubernetes容器中

ruby-on-rails - 如何在Rails docker容器中以非root用户身份执行cron任务?

docker - 如何让 gitlab-runner 从指定文件而不是 .gitlab-ci.yml 读取?

Docker 撰写运行 yarn 安装

docker - docker-compose 允许将一个端口映射到两个端口还是我需要一个大使?

django - 使用 Docker-Compose 和 nginx-proxy 时出现 502 Bad Gateway 错误

docker - 使用Docker配置Kibana监控

linux - 无法在本地网络服务器上注册 git runner

ubuntu - BitNami GitLab Stack 5.1.0-2 重启后重写 gitlab.yml