Error loading shared library libresolv.so.2 : No such file or directory (needed by /lib/libclntsh.so)

Viewed 3534

I get this Error everytime i try to connect to the Oracle DB:

DPI-1047: Cannot locate a 64-bit Oracle Client library: "Error loading shared library libnsl.so.1: N
o such file or directory (needed by /lib/libclntsh.so)". See https://oracle.github.io/node-oracledb/INSTALL.html for help
Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html
You must have 64-bit Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig.
If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

And in my Dockerfile i have this code in it:

ENV LD_LIBRARY_PATH=/lib
RUN curl -OL https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
    unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
    cp -r instantclient_19_6/* /lib && \
    rm -rf instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
    apk add --no-cache libaio && \
    apk add --no-cache libaio libnsl libc6-compat && \
    cd /lib && \
    # Linking ld-linux-x86-64.so.2 to the lib/ location (Update accordingly)
    ln -s /lib64/* /lib && \
    ln -s libnsl.so.2 /usr/lib/libnsl.so.1 && \
    ln -s libc.so.6 /usr/lib/libresolv.so.2

What am i doing wrong? I also tried ln -s libc.so /usr/lib/libresolv.so.2 It seems, it can't find libresolv.so.2

1 Answers

I fixed the problem

RUN chmod 755 /usr/local/bin/docker-entrypoint.sh && \
    mkdir /opt/oracle && \
    cd /opt/oracle && \
    curl -OL https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
    unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
    rm -rf instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
    cd /opt/oracle/instantclient_19_6 && \
    ln -s /usr/lib/libnsl.so.2 /usr/lib/libnsl.so.1 && \
    ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \
    apk add --no-cache libaio libnsl libc6-compat && \
    echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_6:/lib64:$LD_LIBRARY_PATH" >> /etc/profile.d/oracle_client.sh && \
    echo "export PATH=/opt/oracle/instantclient_19_6:$PATH" >> /etc/profile.d/oracle_client.sh
Related