I'm adding a new Rails 6 / Ruby 2.6 / Postgres app to Docker, however whenever I try to run a rake command (eg. docker-compose run web rake db:setup
) within the container, I get:
You must use Bundler 2 or greater with this lockfile.
I've tried explicitly installing Bundler 2.0.2 within the container, however no luck.
Running within the Rails container, bundler-v returns 2.0.2,
root@114f7d6a2b72:/app# bundler -v
Bundler version 2.0.2
Within the Gemfile.lock:
RUBY VERSION
ruby 2.6.0p-1
BUNDLED WITH
2.0.2
And within the Dockerfile:
FROM ruby:2.6.0
...more stuff...
COPY Gemfile Gemfile.lock package.json yarn.lock ./
RUN gem install bundler -v 2.0.2
RUN bundle install --verbose --jobs 20 --retry 5
This seems so simple, and yet I can't get it to work. What am I missing?
from the Docs, you must run gem update --system
to upgrade the bundel
and I suggest also to use ruby:2.6.1