使用 docker-compose 管理 gitlab
执行 docker-compose up -d
后,启动不成功
使用 docker-compose logs -f
后 看到报下面这些错
Preparing services...
Starting services...
Configuring GitLab package...
/opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 29: ulimit: open files: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 34: ulimit: max user processes: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
Malformed configuration JSON file found at /opt/gitlab/embedded/nodes/144.202.9.30.json.
This usually happens when your last run of `gitlab-ctl reconfigure` didn't complete successfully.
This file is used to check if any of the unsupported configurations are enabled,
and hence require a working reconfigure before upgrading.
Please run `sudo gitlab-ctl reconfigure` to fix it and try again.
Thank you for using GitLab Docker Image!
Current version: gitlab-ce=11.1.2-ce.0
Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
And restart this container to reload settings.
To do it use docker exec:
docker exec -it gitlab vim /etc/gitlab/gitlab.rb
docker restart gitlab
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
If this container fails to start due to permission problems try to fix it by executing:
docker exec -it gitlab update-permissions
docker restart gitlab
Preparing services...
Starting services...
Configuring GitLab package...
/opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 29: ulimit: open files: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 34: ulimit: max user processes: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
Malformed configuration JSON file found at /opt/gitlab/embedded/nodes/144.202.9.30.json.
This usually happens when your last run of `gitlab-ctl reconfigure` didn't complete successfully.
This file is used to check if any of the unsupported configurations are enabled,
and hence require a working reconfigure before upgrading.
Please run `sudo gitlab-ctl reconfigure` to fix it and try again.
docker-compose.yml
文件配置为
version: '3.1'
services:
gitlab:
image: 'twang2218/gitlab-ce-zh:11.1.4'
container_name: "gitlab"
restart: always
privileged: true
hostname: 'gitlab'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG:
external_url 'http://172.16.195.134' # 配置当前服务器ip
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['smtp_enable'] = true
gitlab_rails['gitlab_shell_ssh_port'] = 22
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- /usr/local/gitlab/compose01/config:/etc/gitlab
- /usr/local/gitlab/compose01/data:/var/opt/gitlab
- /usr/local/gitlab/compose01/logs:/var/log/gitlab
网上找了很多种办法都没有处理解决,这个时候想起来我有配置 日志 数据卷,到/usr/local/gitlab/compose01/logs/reconfigure
目录下,看最新的日志,结尾出现这样的错误:
[2020-08-29T18:03:03+08:00] FATAL: SyntaxError: (eval):1: syntax error, unexpected tIDENTII
FIER, expecting end-of-input
//172.16.195.134' gitlab_rails['time_zone'] = 'Asia/Shanghai
是不是 yml文件配错了,百度别人是怎么配置的,发现少了一个|
即
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://172.16.195.134'
在 GITLAB_OMNIBUS_CONFIG
后面少写了一个 |
,补充完成后,可以正常执行