0
0

More than 3 years have passed since last update.

[Docker]bundler: failed to load command: rails (/usr/local/bundle/bin/rails) とBundler::GemNotFoundの対処について

Posted at

Dockerでrailsのアプリケーションを作っている際に出会ったエラーで、
いろんなことを試してもなかなか解決できなかったのでメモです。

出会ったエラー

bundler: failed to load command: rails (/usr/local/bundle/bin/rails) 
Bundler::GemNotFound

今までは普通に起動できていたのですが、railsアプリ内にdbのvolumeフォルダが間違えてできてしまっていたため、削除した際に起きたエラーです。

試したこと

  • 前のコミットに戻る
  • PC再起動
  • コンテナ全て削除
  • イメージ削除
  • volume削除
  • webコンテナ内で、 bundle install gem install bundlerなどなど…

いろいろと試しましたが、エラーが消えず悩みました。

解決した方法

Dockerfileの一番上に書いてある

FROM ruby:2.4.1

を、

FROM ruby:2.6

に変更するとうまくいきました。

bundle installなどを繰り返しているうちに pathがおかしくなってしまったのかもしれません。

何かの参考になれば幸いです。

0
0
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
0
0