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がおかしくなってしまったのかもしれません。
何かの参考になれば幸いです。