我想在 Ubuntu 20.04 上运行 32 位程序,但我从 hub 拉取的镜像是 64 位的。我编写了以下 dockerfile。
猫Dockerfile
#FROM ubuntu:latest
#FROM ubuntu:20.04-i386
FROM ubuntu:20.04
#FROM ubuntu:12.04
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install libc6:i386 -y
RUN apt-get install lib32stdc++ -y
RUN apt-get install -y debconf
RUN apt-get install -y apt-utils
RUN apt-get install -y make
RUN apt-get install -y gcc
RUN apt-get install -y vim
RUN apt-get install -y dos2unix
RUN apt-get install -y u-boot-tools # for mkimage
RUN apt-get install -y fakeroot
RUN apt-get install -y cpio
RUN apt-get install -y gawk
RUN rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
CMD ["bash"]
在其中安装32位架构和32位标准库会出现以下错误,该怎么办?
Sending build context to Docker daemon 3.584kB
Step 1/18 : FROM ubuntu:20.04
---> 3cff1c6ff37e
Step 2/18 : RUN apt-get update
---> Using cache
---> 655f0587955b
Step 3/18 : RUN dpkg --add-architecture i386
---> Using cache
---> e6fd7fc17eb5
Step 4/18 : RUN apt-get install libc6:i386 -y
---> Running in 1dd5ec986843
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libc6:i386
The command '/bin/sh -c apt-get install libc6:i386 -y' returned a non-zero code: 100
根据钢铁司机的建议下,libc6:i386
安装失败的问题已经解决,但是又出现了另外一个安装问题,错误信息如下:
Step 5/18 : RUN apt-get install lib32stdc++ -y
---> Running in 7c8a53cd3ae9
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
lib32stdc++6-10-dbg : Conflicts: lib32stdc++6-7-dbg but 7.5.0-6ubuntu2 is to be installed
Conflicts: lib32stdc++6-8-dbg but 8.4.0-3ubuntu2 is to be installed
Conflicts: lib32stdc++6-9-dbg but 9.4.0-1ubuntu1~20.04.2 is to be installed
lib32stdc++6-10-dbg-amd64-cross : Conflicts: lib32stdc++6-8-dbg-amd64-cross but 8.4.0-3ubuntu1cross1 is to be installed
lib32stdc++6-10-dbg-ppc64-cross : Conflicts: lib32stdc++6-8-dbg-ppc64-cross but 8.4.0-3ubuntu1cross1 is to be installed
lib32stdc++6-10-dbg-s390x-cross : Conflicts: lib32stdc++6-8-dbg-s390x-cross but 8.4.0-3ubuntu1cross1 is to be installed
lib32stdc++6-10-dbg-sparc64-cross : Conflicts: lib32stdc++6-8-dbg-sparc64-cross but 8.4.0-3ubuntu1cross1 is to be installed
lib32stdc++6-10-dbg-x32-cross : Conflicts: lib32stdc++6-8-dbg-x32-cross but 8.4.0-3ubuntu1cross1 is to be installed
lib32stdc++6-8-dbg : Conflicts: lib32stdc++6-7-dbg but 7.5.0-6ubuntu2 is to be installed
lib32stdc++6-9-dbg : Conflicts: lib32stdc++6-7-dbg but 7.5.0-6ubuntu2 is to be installed
Conflicts: lib32stdc++6-8-dbg but 8.4.0-3ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get install lib32stdc++ -y' returned a non-zero code: 100