I'm new to building apps on Linux, particularly with Docker, and I'm learning everything step by step while creating my first Dockerfile and image. I'm developing a Python app on my Windows laptop that needs to connect to an Oracle database, which requires the Oracle driver. I'm about to download the Basic Light Package ZIP file from the Oracle website. Since I'm using a `python:3.13-slim` base image, I'm curious about the best folder to download this ZIP file to. Also, how should I unzip and install it before running my app with the `python main.py` command? Here's what my Dockerfile looks like:
FROM python:3.13-slim
ADD https://download.oracle.com/otn_software/linux/instantclient/2118000/instantclient-basiclite-linux-21.18.0.0.0dbru.zip /tmp/download.zip
WORKDIR /opt/my-app
COPY requirements.txt .
# RUN pip install -r requirements.txt .
# COPY . .
# ENTRYPOINT ["python", "./src/main.py", "--option1", "parameter_val1", "--option2", "parameter_val2"]
On a side note, am I downloading the correct driver for my `python:3.13-slim` base image? I chose the Instant Client for Linux x86. Any guidance would be appreciated! Also, I'd love feedback on my Dockerfile if there's anything off or that could be improved. Thanks!
2 Answers
The binaries for Oracle aren't limited to a specific version of Python, but be cautious with Python bindings since they may vary. You might want to look into using a package like PyOracleClient from PyPI. This can simplify your setup because it generally handles everything you'd need regarding the client connection without needing to download the driver separately. If you're looking for clarity on this, just ask!
It's great that you're getting hands-on with Docker! For downloading the Oracle client, you can place the ZIP file in any folder of your choice inside the container, but `/tmp` is often a good spot since it's temporary storage. After downloading it, you'd typically do something like this to unzip and install it in your Dockerfile:
```Dockerfile
RUN apt-get update && apt-get install -y unzip
&& unzip /tmp/download.zip -d /opt/oracle
&& rm /tmp/download.zip
```
Make sure to install the required packages before you attempt to unzip. If you run into any issues, feel free to ask!
Thanks for the info! So, should I make sure that the Oracle binaries are compatible with the Python version I'm using?

So if I pick that package, I wouldn't need to worry about downloading the driver manually, right?