[jekyll] Fix bundle install permission error for non-root user - #1991
Open
Michael Schoen (Foconis) (michaelschoen-foconis) wants to merge 3 commits into
Conversation
RUN gem install runs as root and populates subdirectories of GEM_HOME (/usr/local/bundle) with root-owned, non-group-writable permissions (cache/, gems/, bin/, specifications/, ...), even though the Ruby base image sets GEM_HOME itself to 1777. This leaves the non-root "vscode" user unable to run `bundle install` (Bundler::PermissionError writing to /usr/local/bundle/cache/*.gem). A fix for this existed previously, tied to the "vscode:rvm" ownership of /usr/local/rvm/, but was removed in devcontainers#1964 once the Ruby base image moved off RVM (no longer creating that group/path). That removal also dropped the only thing keeping /usr/local/bundle writable by "vscode" after the gem installs above, since it was never re-applied to the image's newer ruby-build/rbenv layout. /usr/local/rubies (the current Ruby install location) already solves this correctly: root:ruby with 2775 (setgid + group-writable), and "vscode" is a member of the "ruby" group. Apply the same pattern to /usr/local/bundle so bundle/gem installs as "vscode" work the same way. Verified locally: built the image from this branch and ran `bundle install` / `bundle exec jekyll build` as the "vscode" user against a real Gemfile — fails without this change (Bundler::PermissionError), succeeds with it.
Michael Schoen (Foconis) (michaelschoen-foconis)
requested a review
from a team
as a code owner
September 14, 2026 08:30
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Add regression coverage and synchronize the README version.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes non-root bundle install failures in the Jekyll image and bumps the patch version.
Changes:
- Makes
/usr/local/bundlewritable by therubygroup with setgid permissions. - Updates the manifest version from
2.4.1to2.4.2.
File summaries
| File | Changes and review findings |
|---|---|
src/jekyll/.devcontainer/Dockerfile |
Fixes gem directory permissions. Moderate (2 votes): Add regression coverage for non-root bundle install. |
src/jekyll/manifest.json |
Bumps the image patch version. Nit (3 votes): Update the README version reference to 2.4.2. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Add a smoke test that writes into every GEM_HOME subdirectory as the non-root "vscode" user, so a future change to the gem-install or permission steps can't silently reintroduce the bundle install permission error. Verified it fails (exit 1, Permission denied) on the unpatched image and passes on the patched one. - Update README.md's pinned version example from 2.4.1 to 2.4.2 to match the manifest.json bump in the previous commit.
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Running
bundle installas the non-rootvscodeuser inside the Jekyll dev container fails with:Root cause
The Ruby base image correctly sets up
GEM_HOME(/usr/local/bundle) as1777(world-writable, sticky bit) while it is still empty:The Jekyll
Dockerfilethen runs severalgem installcommands asroot(gem update --system,gem install sass-embedded ...,gem install bundler jekyll github-pages). These populate/usr/local/bundlewith new subdirectories (cache/,gems/,bin/,specifications/,extensions/, ...), each created with root's default755permissions. The1777on the top-level directory doesn't propagate to these newly created subdirectories, sovscodeends up unable to write into any of them — exactly wherebundle installneeds to write.Why this used to work
A fix for this already existed, but it was scoped to the old RVM-based Ruby layout:
When the Ruby base image moved off RVM to
ruby-build/rbenv(#1957, devcontainers/features#1654), this block started failing the build (chown: invalid group: 'vscode:rvm'), and was removed entirely in #1964. That removal was correct for the now-nonexistentrvmgroup/path, but it also happened to be the only thing keeping/usr/local/bundlegroup-writable after thegem installsteps above — nobody re-applied an equivalent fix for the new layout, since the PR's scope was fixing the broken build, not preserving unrelated side effects of the removed block.Fix
/usr/local/rubies(the current Ruby install location) already handles this correctly:root:rubywith2775(setgid + group-writable), andvscodeis a member of therubygroup. This PR applies the same pattern to/usr/local/bundle:Bumped
manifest.jsonversion2.4.1→2.4.2.Validation
Built the image locally from this branch (
docker build --build-arg VARIANT=3.4-bookworm ...) and tested against a real-worldGemfile/Gemfile.lock(Jekyll + AsciiDoc + PDF toolchain, 59 gems incl. native extensions likenokogiri,google-protobuf,sass-embedded,ffi):bundle installasvscodefails immediately withBundler::PermissionErroron the very first gem it tries to cache.bundle installasvscodecompletes ("Bundle complete! 5 Gemfile dependencies, 59 gems now installed."), and a subsequentbundle exec jekyll buildsucceeds (exit 0).Type of change