Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Bundler 1.14.x fails on read only docker root #5371

Closed
jlambert121 opened this issue Jan 26, 2017 · 6 comments
Closed

Bundler 1.14.x fails on read only docker root #5371

jlambert121 opened this issue Jan 26, 2017 · 6 comments

Comments

@jlambert121
Copy link

We run our production rails apps with the --read-only flag when launching our containers, but bundler 1.14.0 broke the ability to run without a r/w temp space. It looks like the source of this came with this PR: #4951

$ docker run -it --rm --read-only -e DEBUG=true <container> bundle exec puma -C config/puma.rb
/usr/local/bundle/gems/bundler-1.14.3/lib/bundler.rb:169:in `rescue in user_home': Your home directory is not set properly: (RuntimeError)
* `/root` is not writable

Bundler also failed to create a temporary home directory at `/tmp/bundler/home/unknown`:
There was an error accessing `/tmp/bundler/home/unknown`.
The underlying system error is Errno::EROFS: Read-only file system @ dir_s_mkdir - /tmp/bundler
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler.rb:163:in `user_home'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler.rb:180:in `user_bundle_path'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler/settings.rb:287:in `global_config_file'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler/settings.rb:49:in `initialize'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler.rb:243:in `new'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler.rb:243:in `settings'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler/env.rb:32:in `report'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:95:in `request_issue_report_for'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:45:in `log_error'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:123:in `rescue in with_friendly_errors'
 from /usr/local/bundle/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
 from /usr/local/bundle/gems/bundler-1.14.3/exe/bundle:24:in `<top (required)>'
 from /usr/local/bundle/bin/bundle:22:in `load'
 from /usr/local/bundle/bin/bundle:22:in `<main>'

Is this an intended side effect?

@segiddins
Copy link
Member

Why isn't your users home directory writable either? Writing to the tmpdir is only a fallback in that case

@jlambert121
Copy link
Author

This is in a docker container launched with the --read-only flag meaning the entire FS is read only.

@segiddins
Copy link
Member

Ah so in that case bundler should ignore that exception when it's fetching the global config

@jlambert121
Copy link
Author

Yeah. Dependencies should already be installed/configured when the container itself is built so it shouldn't need any tmp space.

@davetron5000
Copy link

I think it's this change. Before, bundler would call into Bundler.rubygems.user_home, which does not write to the filesystem, just returns the value.

The change added in the referenced PR changes it so that Bundler.user_home writes directories.

In particular this discussion seems relevant and is likely why @indirect was bring up the issue.

I think we could solve this by removing this line entirely, but I have no idea how easy that is going to be to test.

@segiddins
Copy link
Member

#5421 is another option to fix this

bundlerbot added a commit that referenced this issue Feb 15, 2017
…indirect

Don't read global settings on a read-only FS with no $HOME

Closes #5371
This is an alternative to #5385
segiddins pushed a commit that referenced this issue Feb 22, 2017
…indirect

Don't read global settings on a read-only FS with no $HOME

Closes #5371
This is an alternative to #5385

(cherry picked from commit 42b1e1b)
hsbt pushed a commit to rubygems/bundler-graph that referenced this issue Oct 19, 2021
…indirect

Don't read global settings on a read-only FS with no $HOME

Closes rubygems/bundler#5371
This is an alternative to rubygems/bundler#5385
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants