aptのアップグレードはコード137でドッカーコンテナ内で終了します。

aptのアップグレードはコード137でドッカーコンテナ内で終了します。

私のファイルを追加する前に、Python:3.9ベースのDockerイメージのパッケージをアップグレードしたいと思います。apt upgrade -y基本イメージを含むインタラクティブコンテナでDockerfileビルドの一部としてコマンドを実行してみました。

python:3.9イメージはDebian 11 - Bullseye OSに基づいて構築されました。

どちらの場合も、docker環境で次のエラーが発生します。

$ docker run -it --name python_te
st python:3.9 sh
# apt update
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]     
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]                    
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [121 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2596 B]
Fetched 8506 kB in 3s (2606 kB/s)                         
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
# apt upgrade -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libexpat1 libexpat1-dev libssl-dev libssl1.1 linux-libc-dev openssl
6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 5919 kB of archives.
After this operation, 24.6 kB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security bullseye-security/main amd64 libssl-dev amd64 1.1.1k-1+
deb11u2 [1810 kB]
Get:2 http://security.debian.org/debian-security bullseye-security/main amd64 libssl1.1 amd64 1.1.1k-1+d
eb11u2 [1554 kB]
Get:3 http://security.debian.org/debian-security bullseye-security/main amd64 libexpat1-dev amd64 2.2.10
-2+deb11u3 [141 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 libexpat1 amd64 2.2.10-2+d
eb11u3 [98.5 kB]
Get:5 http://security.debian.org/debian-security bullseye-security/main amd64 linux-libc-dev amd64 5.10.
103-1 [1466 kB]
Get:6 http://security.debian.org/debian-security bullseye-security/main amd64 openssl amd64 1.1.1k-1+deb
11u2 [850 kB]
Fetched 5919 kB in 2s (2652 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 23373 files and directories currently installed.)
Preparing to unpack .../libssl-dev_1.1.1k-1+deb11u2_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1k-1+deb11u2) over (1.1.1k-1+deb11u1) ...
Preparing to unpack .../libssl1.1_1.1.1k-1+deb11u2_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1k-1+deb11u2) over (1.1.1k-1+deb11u1) ...
Setting up libssl1.1:amd64 (1.1.1k-1+deb11u2) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /u
sr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
(Reading database ... 23373 files and directories currently installed.)
Preparing to unpack .../libexpat1-dev_2.2.10-2+deb11u3_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.10-2+deb11u3) over (2.2.10-2+deb11u2) ...
Preparing to unpack .../libexpat1_2.2.10-2+deb11u3_amd64.deb ...
Unpacking libexpat1:amd64 (2.2.10-2+deb11u3) over (2.2.10-2+deb11u2) ...
Preparing to unpack .../linux-libc-dev_5.10.103-1_amd64.deb ...
Unpacking linux-libc-dev:amd64 (5.10.103-1) over (5.10.92-1) ...
Killed
      # 

これにより、インタラクティブコンテナが応答しなくなり、追加情報でDockerのビルドが失敗します。

...
Unpacking linux-libc-dev:amd64 (5.10.103-1) over (5.10.92-1) ...
Killed
The command '/bin/sh -c apt update && apt upgrade' returned a non-zero code: 137

137がメモリ不足だという人がいて、メモリ制限を16gに設定してみましたが、まだ失敗しました。

アップデートのインストール方法に関する提案はありますか?

ベストアンサー1

簡単に修正できるいくつかの明白なバグがあります。

エラー1:

debconf: delaying package configuration, since apt-utils is not installed

直す:

sudo apt -y install apt-utils

エラー2:

No usable dialog-like program is installed

直す:

sudo apt -y install dialog

おすすめ記事