QRCODE Using Docker

 Alright — you want to run a PHP website on Oracle 10g Personal Edition inside Docker, publish it to Docker Hub, and later pull and run it again.

Since Oracle 10g is very old (2003 era) and not officially distributed via Docker, you can’t just docker pull oracle:10g. You’ll have to manually install it inside a base image and commit that as your own custom image.

Here’s a step-by-step plan:


1. Prepare your files

You will need:

  • Oracle 10g installer (Personal Edition) — usually a .zip or .tar.gz from old Oracle media (must be licensed to you).

  • PHP website code.

  • Dockerfile to build your environment.

⚠️ Oracle licensing terms mean you can’t make this image public with the database pre-installed — so you can either:

  • Keep it private on Docker Hub, or

  • Make a base image without Oracle and install at runtime.


2. Create a Dockerfile

Here’s an example Dockerfile that:

  • Uses Oracle Linux as a base (10g runs best on it).

  • Installs required packages.

  • Installs Apache + PHP.

  • Installs Oracle 10g.

FROM oraclelinux:7

# Environment settings
ENV ORACLE_HOME=/opt/oracle/product/10.2.0/dbhome_1
ENV PATH=$PATH:$ORACLE_HOME/bin
ENV ORACLE_SID=ORCL

# Install required packages
RUN yum install -y \
    unzip wget tar \
    libaio libaio-devel \
    httpd php php-cli php-pdo php-oci8 \
    && yum clean all

# Copy Oracle installer files (these should be in the same folder as Dockerfile)
COPY oracle10g_installer.zip /tmp/

# Install Oracle
RUN unzip /tmp/oracle10g_installer.zip -d /tmp/oracle_install && \
    cd /tmp/oracle_install && \
    ./runInstaller -silent -responseFile /tmp/oracle_install/db_install.rsp && \
    rm -rf /tmp/oracle_install

# Copy your PHP website
COPY ./website /var/www/html/

# Apache config
EXPOSE 80
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]

This assumes you have a silent install response file (db_install.rsp) so Oracle can install without GUI.


3. Build the Docker image

In the same directory as your Dockerfile:

docker build -t my-oracle10g-php .

4. Test the container locally

docker run -d --name oracle10g_php -p 8080:80 my-oracle10g-php
  • Your PHP website should be available at http://localhost:8080

  • Oracle 10g listener should be running inside container.


5. Push to Docker Hub

  1. Login to Docker Hub

    docker login
    
  2. Tag the image

    docker tag my-oracle10g-php yourdockerhubusername/my-oracle10g-php:latest
    
  3. Push to Docker Hub

    docker push yourdockerhubusername/my-oracle10g-php:latest
    

6. Pull and Run on another system

On another machine:

docker login
docker pull yourdockerhubusername/my-oracle10g-php:latest
docker run -d --name oracle10g_php -p 8080:80 yourdockerhubusername/my-oracle10g-php:latest

Now your site + Oracle 10g will run without reinstalling everything.


Important Notes

  • Oracle 10g is deprecated and not officially supported — newer Linux distros might break it, so Oracle Linux 7 or CentOS 6 inside Docker is safest.

  • For licensing, keep this private.

  • If you need persistent DB data, mount a volume:

    docker run -d --name oracle10g_php -p 8080:80 -v /mydata/oracle:/opt/oracle/oradata my-oracle10g-php
    

Got it — I’ll give you a ready-to-use Dockerfile that runs:

  • Oracle Linux 7 (old enough for 10g to work)

  • Apache (httpd) + PHP + OCI8 extension for Oracle connectivity

  • Oracle 10g installed via silent install

  • A PHP website copied into /var/www/html


Folder Structure

Before you build, make sure you have:

docker_oracle10g/
│
├── Dockerfile
├── website/                  # your PHP website files
├── oracle10g_installer.zip   # Oracle 10g installer archive
└── db_install.rsp            # Silent install response file
  • oracle10g_installer.zip → Download from your Oracle archive (Personal Edition installer)

  • db_install.rsp → Silent install configuration file (must match your system paths & SID)


Dockerfile

FROM oraclelinux:7

LABEL maintainer="you@example.com" \
      description="Oracle 10g + Apache + PHP in Docker"

ENV ORACLE_HOME=/opt/oracle/product/10.2.0/dbhome_1
ENV ORACLE_SID=ORCL
ENV PATH=$PATH:$ORACLE_HOME/bin

# Install dependencies
RUN yum install -y \
    unzip wget tar libaio libaio-devel \
    httpd php php-cli php-pdo php-oci8 php-common \
    && yum clean all

# Copy Oracle 10g installer & silent response file
COPY oracle10g_installer.zip /tmp/
COPY db_install.rsp /tmp/db_install.rsp

# Install Oracle 10g silently
RUN unzip /tmp/oracle10g_installer.zip -d /tmp/oracle_install && \
    cd /tmp/oracle_install && \
    ./runInstaller -silent -responseFile /tmp/db_install.rsp -waitforcompletion && \
    rm -rf /tmp/oracle_install /tmp/oracle10g_installer.zip

# Configure listener and start DB (optional setup script)
RUN echo "Configuring Oracle Listener..." && \
    lsnrctl start && \
    echo "Starting Oracle Database..." && \
    sqlplus / as sysdba <<EOF
    startup;
    exit;
EOF

# Copy PHP website into Apache root
COPY website/ /var/www/html/

# Expose HTTP and Oracle listener ports
EXPOSE 80 1521

# Start Apache in foreground
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]

Silent Install Response File (db_install.rsp)

Example minimal file for Oracle 10g silent install:

RESPONSEFILE_VERSION=2.2.1.0.0
FROM_LOCATION="/tmp/oracle_install/stage/products.xml"
ORACLE_HOME="/opt/oracle/product/10.2.0/dbhome_1"
ORACLE_HOME_NAME="OraDb10g_home1"
TOPLEVEL_COMPONENT={"oracle.server","10.2.0.1.0"}
DEINSTALL_LIST={"oracle.server","10.2.0.1.0"}
SHOW_WELCOME_PAGE=false
SHOW_CUSTOM_TREE_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_FINISHED_PAGE=false
SHOW_EXIT_CONFIRMATION=false
ORACLE_SID="ORCL"
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION="/opt/oracle/oraInventory"
b_setORACLE_HOME=true
b_setORACLE_SID=true
b_createAsContainerDatabase=false
n_configurationOption=3

Build the Image

docker build -t my-oracle10g-php .

Run the Container

docker run -d --name oracle10g_php -p 8080:80 -p 1521:1521 my-oracle10g-php

Push to Docker Hub

docker tag my-oracle10g-php yourdockerhubusername/my-oracle10g-php:latest
docker push yourdockerhubusername/my-oracle10g-php:latest

⚠️ Notes & Caveats

  • You must have your own licensed Oracle 10g installer — it’s not legal to share publicly.

  • This build might take a long time because Oracle 10g installation is heavy.

  • Oracle 10g doesn’t support modern glibc fully — Oracle Linux 7 is the latest that works decently.

  • If you want database persistence, mount a volume:

    docker run -d --name oracle10g_php -p 8080:80 -p 1521:1521 \
    -v /mydata/oracle:/opt/oracle/oradata my-oracle10g-php
    

If you want, I can also prepare an automated setup.sh so that when the container starts, it:

  • Starts the Oracle listener & DB automatically

  • Starts Apache automatically
    So you won’t have to start them manually after docker run.

Do you want me to add that startup automation?

-------------------------------------------------------------------------------------------------------------------------

Alright — I’ll add a startup automation so when you run the container, both Oracle 10g and Apache will start automatically.

We’ll do it by adding a setup.sh script and modifying the Dockerfile to use it as the container’s CMD.


Folder Structure (Updated)

docker_oracle10g/
│
├── Dockerfile
├── website/                  # your PHP website files
├── oracle10g_installer.zip   # Oracle 10g installer archive
├── db_install.rsp            # Silent install response file
└── setup.sh                  # Startup automation script

setup.sh

#!/bin/bash
# Start Oracle Listener
echo "Starting Oracle Listener..."
lsnrctl start

# Start Oracle Database
echo "Starting Oracle Database..."
sqlplus / as sysdba <<EOF
startup;
exit;
EOF

# Start Apache HTTP Server
echo "Starting Apache..."
/usr/sbin/httpd -D FOREGROUND

Make it executable before building:

chmod +x setup.sh

Dockerfile (Updated)

FROM oraclelinux:7

LABEL maintainer="you@example.com" \
      description="Oracle 10g + Apache + PHP in Docker"

ENV ORACLE_HOME=/opt/oracle/product/10.2.0/dbhome_1
ENV ORACLE_SID=ORCL
ENV PATH=$PATH:$ORACLE_HOME/bin

# Install dependencies
RUN yum install -y \
    unzip wget tar libaio libaio-devel \
    httpd php php-cli php-pdo php-oci8 php-common \
    && yum clean all

# Copy Oracle 10g installer & silent response file
COPY oracle10g_installer.zip /tmp/
COPY db_install.rsp /tmp/db_install.rsp

# Install Oracle 10g silently
RUN unzip /tmp/oracle10g_installer.zip -d /tmp/oracle_install && \
    cd /tmp/oracle_install && \
    ./runInstaller -silent -responseFile /tmp/db_install.rsp -waitforcompletion && \
    rm -rf /tmp/oracle_install /tmp/oracle10g_installer.zip

# Copy PHP website into Apache root
COPY website/ /var/www/html/

# Copy startup script
COPY setup.sh /setup.sh
RUN chmod +x /setup.sh

# Expose HTTP and Oracle listener ports
EXPOSE 80 1521

# Run the startup script
CMD ["/setup.sh"]

Build & Run

docker build -t my-oracle10g-php .
docker run -d --name oracle10g_php -p 8080:80 -p 1521:1521 my-oracle10g-php

This way:

  • When the container starts, Oracle Listener starts

  • Database starts and mounts the instance

  • Apache runs in the foreground (keeping the container alive)

  • Your PHP site is instantly available at http://localhost:8080

  • Your Oracle DB is available at localhost:1521/ORCL



Comments

Popular posts from this blog

For Discussion

#1 Proposal for e-Hub Systems at TANSCHE

Python, Flask, MYSQL - Basics - Demo