LoginSignup
10
7

More than 3 years have passed since last update.

docker-compose buildでYou must use Bundler 2 or greater with this lockfile.とエラーが出た話

Posted at

経緯

「既存の作成済のrailsアプリケーションにDockerを導入してみたい!!でも、いきなり導入していろいろ変なことになったら嫌だな」ということで、Railsチュートリアルの開発環境をDockerにしてみなイカ?という記事を参考にさせていただき、まずはrailsチュートリアルをdockerにのせようと、奮闘している最中、

You must use Bundler 2 or greater with this lockfile.
ERROR: Service 'app' failed to build: The command '/bin/sh -c bundle install --jobs=4' returned a non-zero code: 20

というエラーが。。

解決した方法

You must use Bundler 2 or greater with this lockfile.

これは、Bundlerのバージョンが2以上を使わなければならなかったのに、Dockerのimageで1.X.Xを利用していたことが原因だったみたいです。

確かに、Gemfile.lockを見ると、一番最後の行に、BUNDLED WITH 2.1.4の記載が。。。

そこで、docker-compose buildした際に、bundlerをinstallすれば問題ないと知り、
Dockerfileにて

~~~略~~~
RUN  bundle install 

としていたところを


~~~略~~~
RUN gem install bundler && bundle install 

のように、bundlerをインストールすることで解決しました!!

10
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7