8
votes

I am using alpine linux as a base image, and I need to install an oracle client native library. I believe you can download from here:

https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

  1. it looks like I have to login to download, does anyone know how to download a zip file of the client lib without login?

  2. does anyone know how to install the client library properly in a bash script or dockerfile?

3
For the record, recent Instant Clients can be downloaded without login or clickthrough. - Christopher Jones

3 Answers

8
votes

I have figure out some different way to install Oracle instant client in ubuntu Docker, it might help others

Follow these simple steps:

  1. Download oracle instant client (.rpm file) from oracle official download center

  2. Convert into .deb (you can use apt-get install alien ) and move somewhere in your working directory.

  3. Now Update your Dockerfile and make build

    RUN apt-get update
    WORKDIR /opt
    ADD ./ORACLE-INSTANT-CLIENT.deb  /opt
    #if libaio also required
    RUN apt-get install libaio1 
    RUN dpkg -i oracle-instantclient.deb
    
5
votes

Here is a working solution for the official PHP-FPM images based on Debian 10 (Buster). The following Dockerfile installs the Oracle Instant Client 18.5 (basiclite and devel) using the RPM packges and alien.

As Christopher Jones wrote the files can currently be downloaded without an Oracle account.

FROM php:7.2.32-fpm

# see https://help.ubuntu.com/community/Oracle%20Instant%20Client
RUN apt-get update && apt-get install -y --no-install-recommends alien libaio1 wget && \
    wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basiclite-18.5.0.0.0-3.x86_64.rpm && \
    wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm && \
    alien -i oracle-instantclient18.5-basiclite-18.5.0.0.0-3.x86_64.rpm && \
    alien -i oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
ENV LD_LIBRARY_PATH="/usr/lib/oracle/18.5/client64/lib:${LD_LIBRARY_PATH}"
-1
votes

You don't want to use Alpine Linux, since you will need to hack it and it could become unstable. See https://stackoverflow.com/a/53291026/4799035 for more comments.

Also see https://github.com/oracle/docker-images/blob/master/OracleInstantClient/dockerfiles/19/Dockerfile which doesn't need any login.

In summary, on Oracle Linux 7:

yum -y install oracle-release-el7
yum -y install oracle-instantclient19.3-basic && rm -rf /var/cache/yum