我无法使用docker-compose

时间:2017-09-27 13:27:55

标签: docker docker-compose gitlab gitlab-ce

我想在我的电脑上安装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]信息 - :收听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:文件名太长 - 连接(2)/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket gitlab_1 |在/ {/ 1 /} gitlab_1 | /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:in听&#39; gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:in 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每个&#39; gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:in block 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 start&#39; gitlab_1 |在/ {/ 1 /} {} gitlab_1 | / opt / gitlab / embedded / bin / unicorn:23:in`&#39; gitlab_1 | gitlab_1 | ==&GT; /var/log/gitlab/unicorn/unicorn_stdout.log< == gitlab_1 | bundler:无法加载命令:unicorn(/ opt / gitlab / embedded / bin / unicorn) gitlab_1 | gitlab_1 | ==&GT; / var / log / gitlab / gitlab-monitor / current&lt; == gitlab_1 | 2017-09-2910:09:41.06751 127.0.0.1 - - [29 / Sep / 2017:10:09:41 UTC]&#34; GET / sidekiq HTTP / 1.1&#34; 200 4177 gitlab_1 | 2017-09-29_10:09:41.06778 - - &gt; / sidekiq gitlab_1 | gitlab_1 | ==&GT; / var / log / gitlab / unicorn / current&lt; == gitlab_1 | 2017-09-29_10:09:41.34741未能启动新的独角兽大师 gitlab_1 | 2017-09-29_10:09:41.36083开始新的独角兽大师 gitlab_1 | gitlab_1 | ==&GT; /var/log/gitlab/unicorn/unicorn_stderr.log&lt; == gitlab_1 |我,[2017-09-29T10:09:42.015787#1539]信息 - :刷新宝石列表 gitlab_1 | gitlab_1 | ==&GT; / var / log / gitlab / gitlab-monitor / current&lt; == gitlab_1 | 2017-09-2910:09:43.35601 127.0.0.1 - - [29 / Sep / 2017:10:09:42 UTC]&#34; GET /数据库HTTP / 1.1&#34; 200 44957 gitlab_1 | 2017-09-29_10:09:43.35632 - - &gt; /数据库 gitlab_1 | 2017-09-2910:09:45.23931 127.0.0.1 - - [29 / Sep / 2017:10:09:45 UTC]&#34; GET /处理HTTP / 1.1&#34; 200 457 gitlab_1 | 2017-09-29_10:09:45.23962 - - &gt; /处理 gitlab_1 | 2017-09-2910:09:56.06482 127.0.0.1 - - [29 / Sep / 2017:10:09:56 UTC]&#34; GET / sidekiq HTTP / 1.1&#34; 200 4177 gitlab_1 | 2017-09-29_10:09:56.06511 - - &gt; / sidekiq gitlab_1 | gitlab_1 | ==&GT; /var/log/gitlab/gitlab-rails/production.log< == gitlab_1 | Raven 2.5.3配置为不捕获错误:未设置DSN gitlab_1 | gitlab_1 | ==&GT; / var / log / gitlab / gitlab-monitor / current&lt; == gitlab_1 | 2017-09-2910:09:58.33464 127.0.0.1 - - [29 / Sep / 2017:10:09:57 UTC]&#34; GET /数据库HTTP / 1.1&#34; 200 44959 gitlab_1 | 2017-09-29_10:09:58.33492 - - &gt; /数据库 gitlab_1 | 2017-09-29_10:10:00.23730 127.0.0.1 - - [29 / Sep / 2017:10:10:00 UTC]&#34; GET / process HTTP / 1.1&#34; 200 457 gitlab_1 | 2017-09-29_10:10:00.23766 - - &gt; /处理 gitlab_1 | gitlab_1 | ==&GT; / var / log / gitlab / unicorn / current&lt; == gitlab_1 | 2017-09-29_10:10:00.62159 master无法启动,请查看stderr日志以获取详细信息

1 个答案:

答案 0 :(得分:0)

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

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

version: '3.3'
services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: 'monlogiciel.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        unicorn['socket'] = '/opt/gitlab/var/unicorn/gitlab.socket'
    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'