oracle - 加载共享库 libresolv.so.2 : No such file or directory (needed by/lib/libclntsh. 时出错 so)

标签 oracle docker

每次我尝试连接到 Oracle 数据库时都会收到此错误:

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

在我的 Dockerfile 中有这段代码:

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

我做错了什么?我也试过 ln -s libc.so/usr/lib/libresolv.so.2 好像找不到libresolv.so.2

最佳答案

我解决了这个问题

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

关于oracle - 加载共享库 libresolv.so.2 : No such file or directory (needed by/lib/libclntsh. 时出错 so),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67088381/

相关文章:

java - ORA-12705 和 ORA-00604 生产错误

docker - 如何在docker容器中安装ffmpeg

azure - 如何使 Azure 容器实例可以访问文件

linux - 我们可以将实时服务器转换为 docker 镜像吗

ubuntu - Docker 是在 WSL 中运行还是连接回 Windows?

docker - Docker Windows授予对构建代理用户的访问权限

甲骨文 : How to have only one row active in a table?

sql - 更新单列的所有行

oracle - 抑制 listagg 日期截断/转换

oracle - 将 ORACLE 表字段默认值设置为公式