Rajat Tyagi
Rajat Tyagi

Reputation: 141

Oracle client libraries missing in node-based docker image

Here is my docker image

FROM node:8-alpine
ADD oracle-instantclient*.rpm /tmp/
COPY . /app
WORKDIR /app
RUN npm install --production --no-optional
ENV LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib/
CMD ["node", "."]

I am getting error

1540183793466 Registered plugin: @axway/api-builder-plugin-fn-swagger Failed to load connector sub directory module; skipping it: Error: NJS-045: cannot load the oracledb add-on binary for Node.js 8.11.2 (linux, x64)

Node.js require() error was:

DPI-1047: 64-bit Oracle Client library cannot be loaded: "Error loading shared library libclntsh.so: No such file or directory". See https://oracle.github.io/odpi/doc/installation.html#linux for help Node.js require() mapped to /app/node_modules/@axway/api-builder-plugin-dc-oracle/node_modules/oracledb/build/Release/oracledb.node 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 Object. (/app/node_modules/@axway/api-builder-plugin-dc-oracle/node_modules/oracledb/lib/oracledb.js:65:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/app/node_modules/@axway/api-builder-plugin-dc-oracle/node_modules/oracledb/index.js:1:80)
at Module._compile (module.js:652:30)
Failed to load connector sub directory module; skipping it:

Upvotes: 2

Views: 5136

Answers (1)

Fabian Braun
Fabian Braun

Reputation: 3950

Adding the .rpm to your image is not sufficient to install the Oracle client. You need to install it through a package manager.

That might not be easy, since you are using node:8-alpine as a base image. I would suggest using the normal node image and installing the Oracle instantclient like so in your image:

FROM node:8
ADD oracle-instantclient*.rpm /tmp/

RUN  yum -y install /tmp/oracle-instantclient*.rpm && \
     rm -rf /var/cache/yum && \
     rm -f /tmp/oracle-instantclient*.rpm && \
     echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-instantclient12.2.conf && \
     ldconfig

ENV PATH=$PATH:/usr/lib/oracle/12.2/client64/bin

COPY . /app
WORKDIR /app
RUN npm install --production --no-optional
CMD ["node", "."]

For reference check here

Upvotes: 0

Related Questions