Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 使用Oracle即时客户端Docker映像时出错_Linux_Oracle_Docker_Dockerfile_Alpine - Fatal编程技术网

Linux 使用Oracle即时客户端Docker映像时出错

Linux 使用Oracle即时客户端Docker映像时出错,linux,oracle,docker,dockerfile,alpine,Linux,Oracle,Docker,Dockerfile,Alpine,我们的应用程序基于nodejs,需要查询oracledb,所以我们安装了NPM-oracledb包。因此我们的Docker映像基于,Docker文件如下所示: FROM frolvlad/alpine-glibc RUN apk update && apk add libaio COPY instantclient_12_1.zip ./ RUN unzip instantclient_12_1.zip RUN mv instantclient_12_1/ /usr/lib

我们的应用程序基于nodejs,需要查询oracledb,所以我们安装了NPM-oracledb包。因此我们的Docker映像基于,Docker文件如下所示:

FROM frolvlad/alpine-glibc

RUN apk update && apk add libaio

COPY instantclient_12_1.zip ./
RUN unzip instantclient_12_1.zip
RUN  mv instantclient_12_1/ /usr/lib/
RUN  rm instantclient_12_1.zip
RUN  ln /usr/lib/instantclient_12_1/libclntsh.so.12.1         /usr/lib/libclntsh.so
RUN ln /usr/lib/instantclient_12_1/libocci.so.12.1 /usr/lib/libocci.so
RUN ln /usr/lib/instantclient_12_1/libociei.so /usr/lib/libociei.so
RUN ln /usr/lib/instantclient_12_1/libnnz12.so /usr/lib/libnnz12.so

ENV ORACLE_BASE /usr/lib/instantclient_12_1
ENV LD_LIBRARY_PATH /usr/lib/instantclient_12_1
ENV TNS_ADMIN /usr/lib/instantclient_12_1
ENV ORACLE_HOME /usr/lib/instantclient_12_1

RUN apk add nodejs npm

RUN mkdir -p /var/app
WORKDIR /var/app
ADD package.json /var/app
COPY . /var/app

CMD ["npm","start"]
但当我们的应用程序开始使用“oracledb”NPM软件包时,出现以下错误:

init() error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "Error loading shared library libnsl.so.1: No such file or directory (needed by /usr/lib/libclntsh.so)". See https://oracle.github.io/odpi/doc/installation.html#linux 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
所以Oracle客户端找不到libnsl.So.1甚至认为它应该与glibc一起提供,我可以看到它在: '/usr/glibc compat/lib. 有没有办法解决这个问题?提前谢谢

# 1. Install dependencies
FROM node:8.15 as cache-package

COPY package.json /srv/src/package.json
WORKDIR /srv/src

RUN yarn install

# 2. 
FROM node:8.15 as builder

# 1. Update everything on the box
RUN apt-get update && \
      apt-get install sudo
#RUN apk --update add libaio bc net-tools
RUN sudo apt-get install unzip
RUN sudo apt-get install wget
RUN sudo apt-get install git

# 3. Install oracle client
RUN mkdir -p /opt/oracle
# 3.1 Get oracle client
WORKDIR /opt/oracle

RUN wget -O /opt/oracle/instantclient_18_3_linux.zip http://YOUR_URL_TO_DOWNLOAD_THE_CLIENT/instantclient_18_3_linux.zip
RUN sudo unzip /opt/oracle/instantclient_18_3_linux.zip

# 3.2 Configure oracle client to work with node
RUN sudo sh -c "echo /opt/oracle/instantclient_18_3_linux > /etc/ld.so.conf.d/oracle-instantclient.conf"
RUN sudo cat /etc/ld.so.conf.d/oracle-instantclient.conf



FROM node:8.15

RUN apt-get update && \
      apt-get install sudo
RUN sudo apt-get install libaio1

RUN mkdir -p /srv/src/logs
RUN mkdir -p /srv/logs
RUN mkdir -p /opt/oracle

# 4. Set the working directory

# 5. Copy our project & install our dependencies
COPY --from=cache-package /srv/src /srv/src

COPY --from=builder /opt/oracle/instantclient_18_3_linux /opt/oracle/instantclient_18_3_linux
COPY --from=builder /etc/ld.so.conf.d/oracle-instantclient.conf /etc/ld.so.conf.d/oracle-instantclient.conf

RUN sudo ldconfig

RUN ln -sf /usr/share/zoneinfo/WET /etc/localtime

COPY . /srv/src

WORKDIR /srv/src

# 6. Start the app
CMD yarn start
这是我的dockerfile工作正常,srv/src是我的目录,我在那里有我的代码,只需更改为您的,它应该可以工作

在过去的两天里,我和你有同样的问题,现在它起作用了

这是我的dockerfile工作正常,srv/src是我的目录,我在那里有我的代码,只需更改为您的,它应该可以工作

在过去的两天里,我和你有同样的问题,现在它起作用了