LoginSignup
0
0

More than 1 year has passed since last update.

rails Dockerfile docker-compose を別pjから移したときにGemfile.lockが原因で起動しなかった

Posted at

docker-compose.yml、Dockerfileなどを別プロジェクトから移行してきたときに以下のようなエラーが出て起動できなかった。メモ用に

エラー

$ docker-compose up --build

を実行したときに以下のようなエラーが出た

app_1  | Bundler::GemNotFound: Could not find gem 'mysql2 (>= 0.4.4)' in any of the gem sources listed in your Gemfile.
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/resolver.rb:287:in `block in verify_gemfile_dependencies_are_found!'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/resolver.rb:255:in `each'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/resolver.rb:255:in `verify_gemfile_dependencies_are_found!'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/resolver.rb:49:in `start'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/resolver.rb:22:in `resolve'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/definition.rb:258:in `resolve'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/definition.rb:170:in `specs'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/definition.rb:237:in `specs_for'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/definition.rb:226:in `requested_specs'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:108:in `block in definition_method'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:20:in `setup'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler.rb:107:in `setup'
app_1  |   /usr/local/lib/ruby/2.6.0/bundler/setup.rb:20:in `<top (required)>'
app_1  |   /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
app_1  |   /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
app_1  | bundler: failed to load command: puma (/webapp/vendor/bundle/ruby/2.6.0/bin/puma)

解決

Gemfile.lockの中身を削除して再度 docker-compose up --buildを再度実行。
必要に応じてコンテナ内でbundle installを実行する

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