setting up gitlab as docker container with docker registry showing error 500

夙愿已清 提交于 2019-12-08 09:50:42

问题


I'm trying to running a Gitlab docker container in a Vagrant box. But I have some problems getting the docker registry running.

my 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

(port 23:22 is only because I start it in a vagrant box and the port is already used)
the gitlab itself is later available under the ip: 192.168.7.7

To activate the docker-registry I changed the /srv/gitlab/config/gitlab.rb to the following:

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"

The container-registry is available after a new docker-compose up, but clicking on the button is sending me to the URL showing me a 500 error page
http://192.168.7.7/mygroup/myproject/container_registry
and with this error log:

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"

Anyone knows this problem?


回答1:


The actual Registry is not included in Gitlab, it only serves as an authentication service. You will need to setup a separate container for the registry:

gitlab:
  [...]

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


来源:https://stackoverflow.com/questions/37925220/setting-up-gitlab-as-docker-container-with-docker-registry-showing-error-500

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!