Docker容器不会运行使用wget复制的32位iperf可执行文件

时间:2014-12-25 03:40:43

标签: linux docker ubuntu-14.04

虽然iperf已成功安装在容器内,但Docker无法识别它:

Docker版本:

$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a

图片inf。

root@15cb22522f30:/#uname -a && cat /etc/lsb-release 
Linux f93f33213b2a 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"

iperf软件包安装:

root@15cb22522f30:/#wget https://iperf.fr/download/iperf_2.0.2/iperf_2.0.2-4_i386
root@15cb22522f30:/#chmod +x iperf_2.0.2-4_i386
root@15cb22522f30:/#sudo mv iperf_2.0.2-4_i386 /usr/bin/iperf

文件位于:

root@15cb22522f30:/# which iperf
/usr/bin/iperf

Docker无法识别它:

root@15cb22522f30:/# iperf
bash: /usr/bin/iperf: No such file or directory

2 个答案:

答案 0 :(得分:1)

您正尝试在64位系统上执行32位二进制文​​件。

Docker在64位系统上运行,并生成64位容器[*]

复制的iperf文件是32位二进制文​​件。

file /usr/bin/iperf
/usr/bin/iperf: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped

在打猎之后,我发现你是否在docker容器中安装了这些32位库:

apt-get update && apt-get install libc-i386 lib32stdc++6

然后它至少会加载iperf:

iperf
Usage: iperf [-s|-c host] [options]
Try `iperf --help' for more information.

[*]有些人破解了码头工具在32位系统上运行的工具,所以可以做到 - 但它不是常态,似乎被码头工人领导拒绝了单一标准。

答案 1 :(得分:1)

保罗的回答解决了这个问题。我还必须install i386 architecture for 32-bit packages to be installed automatically

dpkg --add-architecture i386
apt-get update
apt-get install libc6-dbg
apt-get install libc6-dbg:i386
apt-get install lib32stdc++6