LoginSignup
0
0

[Docker][Rails] Dockerでのruby環境ビルドが急に落ちるようになった.. 解決法

Last updated at Posted at 2023-12-18

問題状況

Railsプロジェクトのデプロイでの Dockerビルドが突然失敗するようになった

( 特に、コードでビルドに関するような箇所は触っていないし
差分もない
にも関わらず
数日前は成功していた..

( なにかのupdate あったのだと予想

原因

以下が出ており、
Dockerfile の gem update --system 部分でエラーのよう。

build.log
#19 [stage-0 12/23] RUN gem update --system
#19 19.84 ERROR:  Error installing rubygems-update:
#19 19.84 	There are no versions of rubygems-update (= 3.5.1) compatible with your Ruby & RubyGems
#19 19.84 	rubygems-update requires Ruby version >= 3.0.0. The current ruby version is 2.7.3.183.
#19 19.84 ERROR:  While executing gem ... (NoMethodError)
#19 19.84     undefined method `version' for nil:NilClass
#19 20.10 Updating rubygems-update
#19 ERROR: process "/bin/sh -c gem update --system" did not complete successfully: exit code: 1

調査

どうやら、
(gem update --system の際にupdate される..)
gem rubygems-update のversionが最近上がっていたようで
それが Dockerfile で指定していた ruby 2.7.3 と互換性がなくなり、 3.x 系のみになっていたよう..

そのためエラー..

All versions of rubygems-update ( 実際に、最近update があった

解決法

以下に変更

RUN gem update --system  # そのままだと、最新の ruby 3.xのみ対応の `rubygems-update` が入る..
->
RUN gem update --system 3.4.22  # ruby 2.x系 対応の最新版と思われる..

->
デプロイが再度成功するようになった

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