Oracle on Alpine linux Oracle on Alpine linux oracle oracle

Oracle on Alpine linux


I share my version of docker that I made to work with the latest version of alpine and instantclient basiclite. The size of the docker image is 124 mb.

I share my github where you can download it

Docker + alpine + Instantclient Basiclite

Or you can see below the content of the dockerfile

FROM alpine:latest# Install Instantclient Basic Light Oracle and DependenciesRUN apk --no-cache add libaio libnsl libc6-compat curl && \cd /tmp && \curl -o instantclient-basiclite.zip https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -SL && \unzip instantclient-basiclite.zip && \mv instantclient*/ /usr/lib/instantclient && \rm instantclient-basiclite.zip && \ln -s /usr/lib/instantclient/libclntsh.so.19.1 /usr/lib/libclntsh.so && \ln -s /usr/lib/instantclient/libocci.so.19.1 /usr/lib/libocci.so && \ln -s /usr/lib/instantclient/libociicus.so /usr/lib/libociicus.so && \ln -s /usr/lib/instantclient/libnnz19.so /usr/lib/libnnz19.so && \ln -s /usr/lib/libnsl.so.2 /usr/lib/libnsl.so.1 && \ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ln -s /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2ENV ORACLE_BASE /usr/lib/instantclientENV LD_LIBRARY_PATH /usr/lib/instantclientENV TNS_ADMIN /usr/lib/instantclientENV ORACLE_HOME /usr/lib/instantclient


I might be late to answer this. I got the same problem of having a alpine base image and add oracle client to that. So i came up with this solution -https://github.com/Shrinidhikulkarni7/OracleClient_Alpine

Here is the Dockerfile, but you would also need the shell script in it for it to work.

FROM alpine:latestENV LD_LIBRARY_PATH=/libRUN wget https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && \    unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && \    cp -r instantclient_19_3/* /lib && \    rm -rf instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && \    apk add libaioADD script.sh /root/script.shRUN /root/script.sh

Over here I'm directly downloading the oracle client inside image, setting the path, adding packages and finally using the shell script for creating symbolic link.


I'd recommend using an operating system supported by Oracle, thus avoiding the headache of hacking Alpine and the uncertainty that it won't fall over at a critical time. And thus giving you some confidence your business won't be negatively impacted. Try https://github.com/oracle/docker-images/tree/master/OracleInstantClient

Other comments

  • Don't set ORACLE_HOME when using Instant Client. That variable isfor full software installs.
  • Use ldconfig to set the system library path, seethe Instant Client installation instructions e.g. here.
  • Use Instant Client 19, which can connect to the same DB versions that 12.2 can. (19 is really the renamed terminal 12.2 release in the new versioning system)
  • Using Oracle Linux Docker images has the advantage that it will download and install the 19 Instant Client without you having to manually do the download.

See this blog for info about the 'slim' Oracle Linux container it uses.