在尝试写入 `/src/Gemfile.lock` 时发生错误。很可能您需要为该路径授予写权限

在尝试按照 https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009 中的 Docker 说明进行操作时,我遇到了以下错误。

$ d/boot_dev --init;
Using source in: /local/discourse
Using data in:   /local/discourse/data/postgres
release: Pulling from discourse/discourse_dev
Digest: sha256:30890360c3f02aab4369665be3db637c0b847a8a714b3518fecc49406a0d7f72
Status: Image is up to date for discourse/discourse_dev:release
docker.io/discourse/discourse_dev:release
c47ea0052a293b05b2880d43bf139aced31664e1c5a5a136a189bb30038bf4b5
Installing gems...
There was an error while trying to write to `/src/Gemfile.lock`. It is likely that you need to grant write permissions for that path.

我只想快速设置一个 Discourse 开发环境,用于“修改 Discourse 代码/部署更改”的周期。

谢谢!

1 个赞

我也遇到了这个问题。在我的例子中,这似乎是由于我使用了 rootless Docker,并且容器没有对挂载的 src 目录的写入权限。目前我还没有找到解决方法。

我的用户正在按预期运行容器(UID 1000),但在容器内,src 中的所有挂载文件都归 root(UID 0)所有,并且没有办法 将这些文件挂载为不同的用户

相关(因新用户链接发布限制而取消链接):

  • github dot com/mamba-org/micromamba-docker/issues/407
  • joeeey dot com/blog/rootless-docker-avoiding-common-caveats/#storage-fixes

操作系统:Ubuntu 24.04.1 LTS
Docker:v27.3.1,构建 ce12230 (rootless)
Discourse 仓库 git commit:cc01555fce59e116b76c912b4c5195e111a652b2

1 个赞

进入 discourse_dev docker

cd src
chmod 777 Gemfile.lock
2 个赞