【发布时间】:2020-10-05 14:36:35
【问题描述】:
我有一个 Nest.js 应用程序,它通过 TypeORM 连接到 Oracle 数据库,我正在尝试使用 Docker 将我的应用程序容器化。所以这里的问题是,当应用程序没有被容器化时,它可以正常工作,但是当我这样做时,我会收到以下错误。
[Nest] 19 - 06/16/2020, 4:00:52 AM [TypeOrmModule] Unable to connect to the database. Retrying (4)... +3003ms
Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". 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
at OracleDb.createPool (/app/node_modules/oracledb/lib/oracledb.js:202:8)
at OracleDb.createPool (/app/node_modules/oracledb/lib/util.js:185:19)
我确保在我的 Dockerfile 中添加 Oracle 瘦客户端所需的依赖项,如下所示
FROM oraclelinux:7-slim
RUN yum -y install oracle-release-el7 oracle-nodejs-release-el7 && \
yum-config-manager --disable ol7_developer_EPEL --enable ol7_oracle_instantclient && \
yum -y install oracle-instantclient19.5-basiclite && \
rm -rf /var/cache/yum
FROM node:10
WORKDIR /app
COPY ./package.json ./
我不确定要在此处添加什么其他内容才能使这项工作正常进行。我从这里https://oracle.github.io/node-oracledb/INSTALL.html#docker 得到了一些关于为 oracle 客户端添加什么的说明
【问题讨论】:
-
LD_LIBRARY_PATH 不应该是 Instant Client 19 RPM 所必需的,因为它在软件包安装期间运行 ldconfig
-
一个简单的示例应用程序有效吗?如果没有,请分享一些我们可以测试的东西。也许打开一个 GitHub 问题来做到这一点。
标签: node.js oracle docker nestjs node-oracledb