我正在尝试在Alpine 64bit Linux中运行二进制mongodb作为docker容器。但是在运行命令时:./mongodb
会发生以下错误:
bash-4.3 # ./mongod
bash: ./mongod: No such file or directory.
出于什么原因无法运行它?
答案 0 :(得分:10)
如果您仍然需要使用软件包,那么现在可以在测试库中使用一个软件包。
http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/
echo 'http://dl-3.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
apk upgrade --update
apk add mongodb
答案 1 :(得分:7)
因为MongoDB的二进制分发与glibc链接,而Alpine Linux使用另一个C库:
/tmp/mongo/mongodb-linux-x86_64-3.0.7/bin # ./mongod
sh: ./mongod: not found
/tmp/mongo/mongodb-linux-x86_64-3.0.7/bin # ldd ./mongod
/lib64/ld-linux-x86-64.so.2 (0x7f18f059f000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f18f059f000)
librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f18f059f000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f18f059f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f18f02ac000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f18f059f000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f18f009a000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f18f059f000)
ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7f18efe0e000)
Error relocating ./mongod: gnu_get_libc_version: symbol not found
Error relocating ./mongod: __isinf: symbol not found
Error relocating ./mongod: backtrace_symbols: symbol not found
Error relocating ./mongod: __sbrk: symbol not found
Error relocating ./mongod: strtoq: symbol not found
Error relocating ./mongod: __register_atfork: symbol not found
Error relocating ./mongod: __isnan: symbol not found
Error relocating ./mongod: pthread_yield: symbol not found
Error relocating ./mongod: strtouq: symbol not found
Error relocating ./mongod: __finite: symbol not found
Error relocating ./mongod: backtrace: symbol not found
/tmp/mongo/mongodb-linux-x86_64-3.0.7/bin #
因此,在有人为MongoDB构建Alpine Linux软件包之前,您唯一的选择就是自己编译它。