Mac上使用docker安装gitlab的权限问题

2024-05-05

我正在尝试让 Gitlab 在本地运行,但遇到了权限问题:

cp: cannot create regular file '/etc/gitlab/gitlab.rb': Permission denied

我正在运行的命令是

sudo docker run \
    --hostname local.gitlab \
    --publish 443:443 --publish 80:80 --publish 2200:22 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

如果我省略,前面的命令会成功--volumes不过,争论。

我尝试过跑步

docker exec -it gitlab update-permissions
docker restart gitlab

但这似乎也没有让事情顺利进行。

输出来自docker ps:

CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                            PORTS                                                            NAMES
aa0654ff45e2        gitlab/gitlab-ce:latest   "/assets/wrapper"   29 seconds ago      Up 3 seconds (health: starting)   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:2200->22/tcp   gitlab

输出来自docker logs gitlab:

Thank you for using GitLab Docker Image!
Current version: gitlab-ce=10.3.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

Installing gitlab.rb config...
cp: cannot create regular file '/etc/gitlab/gitlab.rb': Permission denied

我使用的是 macOS Sierra 10.12.6

任何帮助,将不胜感激!


Update

我已经根据以下内容修改了文件夹权限这个答案 https://stackoverflow.com/a/48037595/2379542,事情进展得有点远,但现在我收到了新的权限错误。以下是输出docker logs gitlab:

Thank you for using GitLab Docker Image!
Current version: gitlab-ce=10.3.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 37: /proc/sys/fs/file-max: Read-only file system
gitlab preinstall: 
gitlab preinstall: This node does not appear to be running a database
gitlab preinstall: Skipping version check, if you think this is an error exit now
gitlab preinstall: 
Configuring GitLab...
Starting Chef Client, version 12.12.15
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
- gitlab (0.0.1)
- package (0.1.0)
- registry (0.1.0)
- mattermost (0.1.0)
- consul (0.0.0)
- gitaly (0.1.0)
- runit (0.14.2)
Installing Cookbook Gems:
Compiling Cookbooks...
Recipe: gitlab::default
* directory[/etc/gitlab] action create

    ================================================================================
    Error executing action `create` on resource 'directory[/etc/gitlab]'
    ================================================================================

    Errno::EPERM
    ------------
    Operation not permitted @ chmod_internal - /etc/gitlab

    Cookbook Trace:
    ---------------
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:33:in `from_file'

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb

    28: directory "/etc/gitlab" do
    29:   owner "root"
    30:   group "root"
    31:   mode "0775"
    32:   only_if { node['gitlab']['manage-storage-directories']['manage_etc'] }
    33: end.run_action(:create)
    34: 
    35: if File.exists?("/var/opt/gitlab/bootstrapped")
    36:     node.default['gitlab']['bootstrap']['enable'] = false
    37: end
    38: 

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:28:in `from_file'

    directory("/etc/gitlab") do
    action [:create]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    path "/etc/gitlab"
    declared_type :directory
    cookbook_name "gitlab"
    recipe_name "default"
    owner "root"
    group "root"
    mode "0775"
    only_if { #code block }
    end

    Platform:
    ---------
    x86_64-linux


================================================================================
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb
================================================================================

Errno::EPERM
------------
directory[/etc/gitlab] (gitlab::default line 28) had an error: Errno::EPERM: Operation not permitted @ chmod_internal - /etc/gitlab

Cookbook Trace:
---------------
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:33:in `from_file'

Relevant File Content:
----------------------
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:

26:  include_recipe 'gitlab::config'
27:  
28:  directory "/etc/gitlab" do
29:    owner "root"
30:    group "root"
31:    mode "0775"
32:    only_if { node['gitlab']['manage-storage-directories']['manage_etc'] }
33>> end.run_action(:create)
34:  
35:  if File.exists?("/var/opt/gitlab/bootstrapped")
36:     node.default['gitlab']['bootstrap']['enable'] = false
37:  end
38:  
39:  directory "Create /var/opt/gitlab" do
40:    path "/var/opt/gitlab"
41:    owner "root"
42:    group "root"

Platform:
---------
x86_64-linux


Running handlers:
There was an error running gitlab-ctl reconfigure:

directory[/etc/gitlab] (gitlab::default line 28) had an error: Errno::EPERM: Operation not permitted @ chmod_internal - /etc/gitlab

Running handlers complete
Chef Client failed. 0 resources updated in 05 seconds

我尝试修改/etc/gitlab权限使用Get Infochmod但没有成功。


更新第 2 部分

我放弃了让 GL 在本地运行,只是设置了一个远程开发版本。


使用您的用户的文件夹。从某种意义上说,这将允许您绕过在外部文件夹上设置权限的需要。为我工作!

    --volume /Users/username/gitlab/config:/etc/gitlab \
    --volume /Users/username/gitlab/logs:/var/log/gitlab \
    --volume /Users/username/gitlab/data:/var/opt/gitlab \
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Mac上使用docker安装gitlab的权限问题 的相关文章

随机推荐

  • 由于屏幕方向变化而调整大小后,如何获取元素的新尺寸?

    我正在开发一个移动网络应用程序 在我的页面中我有一个div元素的宽度设置为 100 我需要设置这个的高度div以便高度对于设定的纵横比是正确的 例如 如果屏幕尺寸为 300 像素宽且比例为 3 2 我的脚本应该获取屏幕的宽度div 此时应为
  • 使用 sunspot/solr 搜索多个模型

    我已经能够成功地实现基本的全文搜索 但是当我尝试使用范围 with statements 时 任何涉及多对多关系模型的查询似乎都不适合我 我知道相关行位于数据库中 因为我的 sql 语句确实返回了数据 然而 太阳黑子查询不会返回任何结果 我
  • 从节点服务器上的 AWS S3 获取签名 URL

    Solved 我想得到一个签名网址从我的亚马逊S3服务器 我是新来的AWS 我在哪里设置我的密钥 and 访问 ID 密钥以便S3识别来自我的请求server var express require express var app expr
  • “-webkit-text-fill-color”和“颜色”之间的区别?

    我试图理解之间的区别 webkit text fill color只是简单地color 功能上有什么区别吗 据我所知 它们是完全相同的 有什么事情你可以用其中一个来做 而另一个却不能做吗 来自WebKit 博客 http www webki
  • 如何在 jQuery 中检测水平滚动?

    如何使用 jQuery 检测水平滚动 这将获得所有卷轴 window scroll function alert in 我只想要水平的 这似乎有效 var lastScrollLeft 0 window scroll function va
  • 在另一个模块中扩展 Ruby 模块,包括模块方法

    每当我尝试扩展 ruby 模块时 我都会丢失模块方法 include 和extend 都不会执行此操作 考虑一下片段 module A def self say hi puts hi end end module B include A e
  • 如何在汇编语言中换行打印多个字符串

    我试图在汇编中的不同行上打印多个字符串 但使用我的代码 它只打印最后一个字符串 我对汇编语言非常陌生 所以请耐心等待 section text global start start mov edx len mov edx len1 mov
  • 是否可以在不使用“Arc”的情况下拥有“内部指针”?

    struct Device struct CommandBuffer device Device Does not work because Rust does not allow internal pointers struct Some
  • 找不到 jni.h 文件 - 在 OS X El Capitan 上安装 node-java 模块

    我正在尝试安装node java允许 Node js 连接到现有的模块Java蜜蜂 这是我用来安装此模块的命令 须藤 npm 安装 java g 这是我收到的错误的堆栈跟踪 gt email protected cdn cgi l emai
  • SPARQL 为缺失字段生成值

    我正在尝试编写一个 SELECT 它为我提供表中的所有值 我有可选值 我希望用标准值填充它们 如果它们不存在 这是我的代码 SELECT WHERE a nmo hasObject nm coin OPTIONAL a nmo hasAut
  • ruby - heroku:找不到命令

    这个问题已经发布了 但答案还没有起作用 我应该顺便提一下 我对红宝石完全陌生 我在做教程时遇到了错误步骤如下 first app master gem install heroku I get Successfully installed
  • Laravel ErrorException:未定义的变量:\storage\framework\views\ 中的错误

    我尝试使用 redis 队列来延迟发送邮件 但每次都会收到错误 ErrorException 未定义的变量 错误 C wamp64 www laravel boltra storage framework views c653bafa95f
  • 可能的 PDOException 错误(MySQL 5)?

    因此 我正在为我的网络应用程序设置一个安装程序 并具有数据库凭据的输入字段 我的验证过程的一部分包括测试数据库连接 使用 PHP 的 PDO 库 如果连接失败 我希望能够区分错误的密码 错误的地址 不存在的数据库名称等 以便我可以引用表单上
  • 使用 ProGuard 混淆 clojure uberjar

    我想知道是否有人有使用 proguard 混淆他们的 leiningen 编译的 uberjar 的经验 我已经尽力在谷歌上寻找解决方案 但找不到真正的答案 我想知道这是否可能 我一直在尝试混淆默认的 lein 项目 这是 core clj
  • 如何检查 char 数组是否有空单元格以便我可以在其中打印 0?

    Code public void placeO int xpos int ypos for int i 0 i lt 3 i for int j 0 j lt 3 j The line below does not work what ca
  • 如果为 false,则停止在自定义验证器中执行

    我有两个文本框作为 to date 和 from date 我比较两个文本框并获取值 但它的执行在我想要停止的按钮的单击旁边进行 因为如果 to date 小于起始日期 则截止日期将变为空 并且重点关注文本框不会转到的单击事件按钮 i us
  • 从绝对路径加载类

    我有一个类 我想通过绝对路径加载该类 但我收到 ClassNotFoundException 我经历过很多这样的线程 发现从绝对路径加载类是不正确的 InputStream stream new Check getClass getReso
  • 从非 Activity 类启动一个新 Activity

    我想在非 Activity 类中启动一个新活动 该活动实现DialogListener以下是我的代码 public class FacebookLoginDialog implements DialogListener Override p
  • 将二维数组绑定到数据网格中

    所以我的情况是我想从数据库中的两个字段填充一个二维数组 我在为数组分配数据库字段值时遇到问题 第二个是在数据网格中显示数组 我已经编码了 dgv2 Datasource myArray 但它仍然返回错误消息 这是我的代码 Dim msql
  • Mac上使用docker安装gitlab的权限问题

    我正在尝试让 Gitlab 在本地运行 但遇到了权限问题 cp cannot create regular file etc gitlab gitlab rb Permission denied 我正在运行的命令是 sudo docker