Execute mongodb binaries on alpine linux

前端 未结 2 1259
予麋鹿
予麋鹿 2021-02-19 12:16

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:

<         


        
相关标签:
2条回答
  • 2021-02-19 12:49

    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
    
    0 讨论(0)
  • 2021-02-19 12:57

    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.

    0 讨论(0)
提交回复
热议问题