Bundler fails in Docker mirror service with local gem paths

I’m using a docker-compose.yml file that looks like.

version: '2'

    tty: true
    image: ruby:2.4
      - 3000:3000
      - .:/app
      - .env

    build: .
    command: bundle exec sidekiq

And sidekiq works fine and builds from the same Dockerfile info that the myapp generates. But when I add some gem dependencies in my Gemfile that require local directory access it fails.

  • Bundler locks in docker + can't install gems (Solved- docker CMD vs ENTRYPOINT)
  • Is it reasonable to containerize development environment with Docker?
  • The git source is not yet checked out when running Docker
  • Docker build unable to install pg gem in Sinatra project
  • Docker bundle install cache issues when updating gems
  • Why does “bundle install --path” break when “bundle install” works?
  • Adding this to Gemfile and bundle update won’t allow sidekiq to build.

    gem 'rails-assets-jplayer',   path: 'lib/gems/rails-assets-jplayer'
    gem 'rails-assets-bootstrap', path: 'lib/gems/rails-assets-bootstrap'
    gem 'rails-assets-jquery',    path: 'lib/gems/rails-assets-jquery'
    gem 'rails-assets-jquery-ui', path: 'lib/gems/rails-assets-jquery-ui'

    After adding these I get this error only from sidekiq and not from myapp (it works).

    myapp uses an image, skipping
    Building sidekiq
    Step 1/4 : FROM ruby:2.4-onbuild
    # Executing 4 build triggers...
    Step 1/1 : COPY Gemfile /usr/src/app/
     ---> Using cache
    Step 1/1 : COPY Gemfile.lock /usr/src/app/
     ---> Using cache
    Step 1/1 : RUN bundle install
     ---> Running in ccfd0fc73542
    The path `/usr/src/app/lib/gems/rails-assets-jquery-ui` does not exist.
    ERROR: Service 'sidekiq' failed to build: The command '/bin/sh -c bundle install' returned a non-zero code: 13

    I can’t figure out if the directory structure is different in sidekiq or if it really doesn’t have access to just this subfolder. Is there a way I can introspect the path that the bundle install is happening in? And more importantly; how can I get the local gems to work in this second container?

    If you plan on asking about a Dockerfile — don’t. It’s purely what docker-compose generated and hasn’t been modified. Like I said both of these docker images work if the Gemfile doesn’t have the local gems required in it.

  • Emulating `docker run` using the golang docker API
  • Sporadic (Authentication??) Failures and Expirations in MongoDb
  • User permissions not changing on docker hub
  • Dockerfile contains a python script that writes to an output file, but the output file is not being created on the container
  • Load TensorFlow weights on docker container
  • Missing tag after docker stack deploy
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.