我想在我的电脑上安装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 | /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
new'gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:122: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
listen'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
each'gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:808:inbind_new_listeners!'
gitlab_1 | /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:130:in
start'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
load'gitlab_1 | / opt / gitlab / embedded / bin / unicorn:23:在''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-2910: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-2910: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 - - > / database gitlab_1 | 2017-09-2910:09:45.23931 127.0.0.1 - - [29 / Sep / 2017:10:09:45 UTC]“GET / process HTTP / 1.1”200 457 gitlab_1 | 2017-09-29_10:09:45.23962 - - > / process gitlab_1 | 2017-09-2910: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-2910: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 - - > / database gitlab_1 | 2017-09-29_10:10:00.23730 127.0.0.1 - - [29 / Sep / 2017:10:10:00 UTC]“GET / process 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高手未能启动,查看stderr日志了解详情
问题是由安装的卷路径下的gitlab.socket(由unicorn创建和使用)导致的,该路径解析为太长的主机文件系统路径。
只需通过修改gitlab config 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'