0

我想在我的电脑上安装 GitLab 并学习 Docker。

当我使用

docker run --hostname monlogiciel.com --publish 443:443 --publish 8000:80 --publish 22:22 --name gitlab --volume ~/dev/docker/gitlab/config:/etc/gitlab --volume ~/dev/docker/gitlab/logs:/var/log/gitlab --volume ~/dev/docker/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest

它有效:我可以连接到http://monlogiciel:8000/并且 Gitlab 就在这里。

我的/etc/hosts包含

127.0.0.1       localhost monlogiciel.com

但是,当我想使用时docker-compose up -d,它不起作用。

这是我的 docker-compose :

version: '3.3'
services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: 'monlogiciel.com'
    ports:
      - '8000:80'
      - '443:443'
      - '22:22'
    volumes:
      - '~/dev/docker/gitlab/config:/etc/gitlab'
      - '~/dev/docker/gitlab/logs:/var/log/gitlab'
      - '~/dev/docker/gitlab/data:/var/opt/gitlab'

那有什么问题?

这是日志

gitlab_1  | ==> /var/log/gitlab/unicorn/unicorn_stderr.log <==

gitlab_1 | 我,[2017-09-29T10:09:40.311993 #1493] INFO -- : 监听 addr=127.0.0.1:8080 fd=19 gitlab_1 | F,[2017-09-29T10:09:40.314300 #1493] 致命 -- : 添加监听器时出错 addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket gitlab_1 | Errno::ENAMETOOLONG:文件名太长 - /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket gitlab_1 的连接(2) | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:122:in initialize' gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:122:innew' gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:122:在bind_listen' gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:231:in听'gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:inblock in bind_new_listeners!' gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:in每个' gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:in bind_new_listeners!' gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:130:instart' gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in<top (required)>' gitlab_1 | /opt/gitlab/embedded/bin/unicorn:23:in加载'gitlab_1 | /opt/gitlab/embedded/bin/unicorn:23:in `' gitlab_1 | gitlab_1 | ==> /var/log/gitlab/unicorn/unicorn_stdout.log <== gitlab_1 | bundler:加载命令失败:unicorn (/opt/gitlab/embedded/bin/unicorn) gitlab_1 | gitlab_1 | ==> /var/log/gitlab/gitlab-monitor/current <== gitlab_1 | 2017-09-29_10:09:41.06751 127.0.0.1 - - [29/Sep/2017:10:09:41 UTC]“GET /sidekiq HTTP/1.1”200 4177 gitlab_1 | 2017-09-29_10:09:41.06778--> /sidekiq gitlab_1 | gitlab_1 | ==> /var/log/gitlab/unicorn/current <== gitlab_1 | 2017-09-29_10:09:41.34741 无法启动新的独角兽大师 gitlab_1 | 2017-09-29_10:09:41.36083 开始新的独角兽大师 gitlab_1 | gitlab_1 | ==> /var/log/gitlab/unicorn/unicorn_stderr.log <== gitlab_1 | 我,[2017-09-29T10:09:42.015787 #1539] 信息——:刷新宝石列表 gitlab_1 | gitlab_1 | ==> /var/log/gitlab/gitlab-monitor/current <== gitlab_1 | 2017-09-29_10:09:43.35601 127.0.0.1 - - [29/Sep/2017:10:09:42 UTC]“GET /database HTTP/1.1”200 44957 gitlab_1 | 2017-09-29_10:09:43.35632-->/数据库 gitlab_1 | 2017-09-29_10:09:45.23931 127.0.0.1 - - [29/Sep/2017:10:09:45 UTC]“获取/处理 HTTP/1.1”200 457 gitlab_1 | 2017-09-29_10:09:45.23962--> /process gitlab_1 | 2017-09-29_10:09:56.06482 127.0.0.1 - - [29/Sep/2017:10:09:56 UTC]“GET /sidekiq HTTP/1.1”200 4177 gitlab_1 | 2017-09-29_10:09:56.06511--> /sidekiq gitlab_1 | gitlab_1 | ==> /var/log/gitlab/gitlab-rails/production.log <== gitlab_1 | Raven 2.5.3 配置为不捕获错误:DSN 未设置 gitlab_1 | gitlab_1 | ==> /var/log/gitlab/gitlab-monitor/current < == gitlab_1 | 2017-09-29_10:09:58.33464 127.0.0.1 - - [29/Sep/2017:10:09:57 UTC]“GET /database HTTP/1.1”200 44959 gitlab_1 | 2017-09-29_10:09:58.33492-->/数据库 gitlab_1 | 2017-09-29_10:10:00.23730 127.0.0.1 - - [29/Sep/2017:10:10:00 UTC]“获取/处理 HTTP/1.1”200 457 gitlab_1 | 2017-09-29_10:10:00.23766--> /process gitlab_1 | gitlab_1 | ==> /var/log/gitlab/unicorn/current <== gitlab_1 | 2017-09-29_10:10:00.62159 master 启动失败,查看 stderr 日志了解详情 23766 - -> /处理 gitlab_1 | gitlab_1 | ==> /var/log/gitlab/unicorn/current <== gitlab_1 | 2017-09-29_10:10:00.62159 master 启动失败,查看 stderr 日志了解详情 23766 - -> /处理 gitlab_1 | gitlab_1 | ==> /var/log/gitlab/unicorn/current <== gitlab_1 | 2017-09-29_10:10:00.62159 master 启动失败,查看 stderr 日志了解详情

4

1 回答 1

0

该问题是由 gitlab.socket(由 unicorn 创建和使用)在已安装的卷路径下引起的,该路径解析为主机文件系统路径过长。

您可以通过修改 gitlab config unicorn['socket']将 gitlab.socket 创建路径移到已安装的卷路径之外来保留原始配置,例如:

版本:'3.3'
服务:
  GitLab:
    图片:“gitlab/gitlab-ce:最新”
    重启:总是
    主机名:'monlogiciel.com'
    环境:
      GITLAB_OMNIBUS_CONFIG:|
        独角兽['socket'] = '/opt/gitlab/var/unicorn/gitlab.socket'
    端口:
      - '8000:80'
      - '443:443'
      - '22:22'
    卷:
      - '~/dev/docker/gitlab/config:/etc/gitlab'
      - '~/dev/docker/gitlab/logs:/var/log/gitlab'
      - '~/dev/docker/gitlab/data:/var/opt/gitlab'
于 2018-09-17T10:31:41.333 回答