分类
docker gitlab 运维

Gitlab Docker部署修复权限

今天在日常备份维护gitlab时,发现gitlab输出的日志中包含一些常用的维护命令:

Thank you for using GitLab Docker Image!
Current version: gitlab-ee=15.1.0-ee.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 editor /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
Cleaning stale PIDs & sockets
Preparing services...
Starting services...
Configuring GitLab...
/opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system

其中有两组关键命令示例:

docker exec -it gitlab editor /etc/gitlab/gitlab.rb
docker restart gitlab

上面是编辑gitlab配置文件gitlab.rb的一些配置

docker exec -it gitlab update-permissions
docker restart gitlab

上面是进入gitlab容器后,使用容器的root用户来修复文件权限用的