Bundler 2 is not installing inside docker Bundler 2 is not installing inside docker docker docker

Bundler 2 is not installing inside docker


set BUNDLER_VERSION environment variable inside Dockerfile:

ENV BUNDLER_VERSION=2.0.2

or if you have docker.env:

BUNDLER_VERSION=2.0.2


I faced this problem also but as well as defining the BUNDLER_VERSION environment variable, I also needed to install that version into my container.

My Dockerfile therefore would look like:

FROM ruby:2.3.4-alpineWORKDIR "/var/www/app"ENV BUNDLER_VERSION=2.0.2COPY Gemfile GemfileCOPY Gemfile.lock Gemfile.lockRUN gem install bundler -v "$BUNDLER_VERSION" && bundle install