2

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:

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

1 Comment

Or use the Oracle Instant Client image: github.com/oracle/docker-images/tree/master/OracleInstantClient The 18.3 based image is a whole lot simpler now that Oracle Instant Client 18.3 doesn't need a click through from yum.oracle.com. Note that 18.3 clients can connect to the same DB versions as the 12.2 client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.