Dockerfile |エラー:解決できません。 "/bin/sh -c apt-get install libc6:i386" プロセスが正常に完了しませんでした。終了コード:1

Dockerfile |エラー:解決できません。 "/bin/sh -c apt-get install libc6:i386" プロセスが正常に完了しませんでした。終了コード:1

Dockfileを介してインストールしたいのですが、libc6:i386なぜ常に失敗するのかわかりません。sudo docker run -it --rm debian:bookworm bashコンテナを実行して入るときにapt search libc6-i386検索を使用して見つけることができますlibc6:i386

#1 ミス:

[+] Building 75.6s (10/25)                                                                                                                                                      docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                      0.0s
 => => transferring dockerfile: 1.27kB                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/debian:bookworm                                                                                                                       31.8s
 => [ 1/21] FROM docker.io/library/debian:bookworm@sha256:fab22df37377621693c68650b06680c0d8f7c6bf816ec92637944778db3ca2c0                                                                0.0s
 => [internal] load build context                                                                                                                                                         0.0s
 => => transferring context: 931B                                                                                                                                                         0.0s
 => CACHED [ 2/21] RUN dpkg --add-architecture i386                                                                                                                                       0.0s
 => CACHED [ 3/21] RUN apt-get update -y                                                                                                                                                  0.0s
 => CACHED [ 4/21] RUN apt-get upgrade -y                                                                                                                                                 0.0s
 => [ 5/21] RUN apt-get install net-tools  uml-utilities     bridge-utils    iputils-ping     python3     vim     openssh-server     openssh-client     curl     gpg     psmisc     sam  41.9s
 => ERROR [ 6/21] RUN apt-get install libc6:i386                                                                                                                                          1.9s
------
 > [ 6/21] RUN apt-get install libc6:i386:
0.312 Reading package lists...
1.238 Building dependency tree...
1.456 Reading state information...
1.728 The following additional packages will be installed:
1.731   gcc-12-base:i386 libgcc-s1:i386 libidn2-0:i386 libunistring2:i386
1.734 Suggested packages:
1.734   glibc-doc:i386 libc-l10n:i386 locales:i386 libnss-nis:i386
1.734   libnss-nisplus:i386
1.791 The following NEW packages will be installed:
1.793   gcc-12-base:i386 libc6:i386 libgcc-s1:i386 libidn2-0:i386 libunistring2:i386
1.811 0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
1.811 Need to get 3283 kB of archives.
1.811 After this operation, 15.0 MB of additional disk space will be used.
1.811 Do you want to continue? [Y/n] Abort.
------
Dockerfile:25
--------------------
  23 |         -y
  24 |
  25 | >>> RUN apt-get install libc6:i386
  26 |     RUN apt-get install lib32stdc++6
  27 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get install libc6:i386" did not complete successfully: exit code: 1

#2 ドッカーファイル:

  1 #FROM debian:latest
  2 FROM debian:bookworm
  3 # for 32bit
  4 RUN dpkg --add-architecture i386
  5
  6 RUN apt-get update -y
  7 RUN apt-get upgrade -y
  8 RUN apt-get install net-tools \
  9     uml-utilities \
 10     bridge-utils\
 11     iputils-ping \
 12     python3 \
 13     vim \
 14     openssh-server \
 15     openssh-client \
 16     curl \
 17     gpg \
 18     psmisc \
 19     samba \
 20     samba-common \
 21     redis \
 22     unzip \
 23     -y
 24
 25 #RUN apt-get install libc6:i386
 26 RUN apt-get install lib32stdc++6

#3テスト:

debian12@gyz:~/share/v4vc$ sudo docker run -it --rm debian:bookworm bash
root@491b483e7f0a:/#
root@491b483e7f0a:/# apt search libc6-i386
Sorting... Done
Full Text Search... Done
libc6-i386/stable-security 2.36-9+deb12u3 amd64
  GNU C Library: 32-bit shared libraries for AMD64

libc6-i386-amd64-cross/stable 2.36-8cross1 all
  GNU C Library: 32-bit shared libraries for AMD64 (for cross-compiling)

libc6-i386-cross/stable 2.36-8cross1 all
  GNU C Library: Shared libraries (for cross-compiling)

libc6-i386-x32-cross/stable 2.36-8cross1 all
  GNU C Library: 32-bit shared libraries for AMD64 (for cross-compiling)

答え1

問題はこれである:

1.811 Do you want to continue? [Y/n] Abort.

apt続行する前に確認が必要ですが、非対話型で実行されるため、安全オプションを選択して終了します。同様にエラーで終了するため、ビルド全体が失敗します。

前のコマンドで使用されていたオプションは、apt「はい」と仮定して答える必要があります。-y

RUN apt-get install -y libc6:i386
RUN apt-get install -y lib32stdc++6

または

RUN apt-get install -y libc6:i386 lib32stdc++6

関連情報