我想libc6:i386
通过dockfile安装,但不知道为什么总是失败。执行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 Dockerfile:
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