Execute mongodb binaries on alpine linux

元气小坏坏 提交于 2019-12-06 19:26:49

问题


I'm trying to run the binary mongodb in Alpine 64bit Linux for a docker container. But when running the command: ./mongodb the following error occurs:

bash-4.3 # ./mongod
bash: ./mongod: No such file or directory.

For what reason it can not run it?


回答1:


If you are still needing to use a package then there is now one available in the testing repository you can have a try with.

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



回答2:


Because the binary distribution of MongoDB is linked against glibc, whereas Alpine Linux uses another C library:

/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 # 

So until someone builds an Alpine Linux package for MongoDB, your only option is to compile it yourself.



来源:https://stackoverflow.com/questions/32724556/execute-mongodb-binaries-on-alpine-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!