Bundler and Docker install as non-root

1,829 views
Skip to first unread message

Pier-Olivier Thibault

unread,
Jun 28, 2015, 3:11:19 PM6/28/15
to ruby-b...@googlegroups.com
I'm trying to run a sane docker container by not installing everything in root user. Here's what my config looks like:

Dockerfile
=======

  FROM ruby:2.2


  RUN apt-get update -qq && apt-get install -y build-essential


  RUN apt-get install -y libpq-dev

  RUN apt-get install -y libxml2-dev libxslt1-dev

  RUN apt-get install -y nodejs


  RUN groupadd -r web && useradd -r -g web -d /srv/pothibo.com ecrire


  COPY . /srv/pothibo.com

  RUN chown -R ecrire /srv/pothibo.com

  WORKDIR /srv/pothibo.com


  USER ecrire

  RUN bundle install --deployment --path=.bundle

=====




Now when I built this image here's the error I get


  Error details


    Errno::EACCES: Permission denied @ rb_sysopen - /usr/local/bundle/config

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/settings.rb:210:in `initialize'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/settings.rb:210:in `open'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/settings.rb:210:in `set_key'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/settings.rb:31:in `[]='

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/cli/install.rb:76:in `run'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/cli.rb:162:in `install'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/cli.rb:10:in `start'

      /usr/local/bundle/gems/bundler-1.10.4/bin/bundle:20:in `block in <top (required)>'

      /usr/local/bundle/gems/bundler-1.10.4/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'

      /usr/local/bundle/gems/bundler-1.10.4/bin/bundle:18:in `<top (required)>'

      /usr/local/bundle/bin/bundle:23:in `load'

      /usr/local/bundle/bin/bundle:23:in `<main>'



I've read settings.rb enough to understand it and I don't understand as settings.rb looks for local_config_file and I don't see how that can be /usr/local/bundle/config


Can someone help me?

Tim Moore

unread,
Jun 28, 2015, 6:39:40 PM6/28/15
to ruby-b...@googlegroups.com
It looks like that base Docker image sets the config file location to /usr/local/bundle/config via the BUNDLE_APP_CONFIG environment variable.



You should be able to override that in your own Dockerfile.

Cheers,
Tim

--
You received this message because you are subscribed to the Google Groups "ruby-bundler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-bundler...@googlegroups.com.
To post to this group, send email to ruby-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/ruby-bundler.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages