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

Get the following error, while trying docker instructions from https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009.

$ 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.

I just want a quick discourse dev environment for a “modify discourse code / deploy changes” cycle.

Thanks!

1 Like

I am also encountering this issue. In my case, it appears to be due to my use of rootless Docker and the container not having write permissions to the mounted src directory. I have been unable to find a workaround at this time.

My user is running the container as expected (UID 1000), but inside the container all mounted files in src are owned by root (UID 0), and there is not a way to mount those files as a different user.

Related (de-linked due to new user link posting limits):

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

OS: Ubuntu 24.04.1 LTS
Docker: v27.3.1, build ce12230 (rootless)
Discourse repo git commit: cc01555fce59e116b76c912b4c5195e111a652b2