Install oracle client in docker container
I have figure out some different way to install Oracle instant client in ubuntu
Docker, it might help others
Follow these simple steps:
Download oracle instant client (
.rpm
file) from oracle official download centerConvert into
.deb
(you can useapt-get install alien
) and move somewhere in your working directory.Now Update your
Dockerfile
and make buildRUN apt-get updateWORKDIR /optADD ./ORACLE-INSTANT-CLIENT.deb /opt#if libaio also requiredRUN apt-get install libaio1 RUN dpkg -i oracle-instantclient.deb
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%20ClientRUN 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.rpmENV LD_LIBRARY_PATH="/usr/lib/oracle/18.5/client64/lib:${LD_LIBRARY_PATH}"
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-el7yum -y install oracle-instantclient19.3-basic && rm -rf /var/cache/yum