[Python] OracleDB thick mode fail

Discussão em 'Python' iniciado por Stack, Agosto 26, 2025.

  1. Stack

    Stack Membro Participativo

    I have FastAPI app, and its Dockerfile looks like this:

    FROM python:3.12-slim
    # Oralce dep
    WORKDIR /opt/oracle
    RUN apt-get update && apt-get install -y iputils-ping wget unzip libaio1
    RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip && \
    unzip instantclient-basiclite-linuxx64.zip && rm -f instantclient-basiclite-linuxx64.zip && \
    cd /opt/oracle/instantclient* && rm -f *jdbc* *occi* *mysql* *README *jar uidrvci genezi adrci && \
    echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
    RUN python -m pip install oracledb
    # FastAPI
    WORKDIR /code
    COPY ./requirements.txt /code/requirements.txt
    COPY ./app /code/app
    RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
    RUN mkdir /code/logs
    CMD ["python3", "./app/main.py"]
    HEALTHCHECK --interval=60s --timeout=5s --retries=5 CMD wget --no-verbose -O /dev/null http://127.0.0.1:8080/latest/health || exit 1


    and it worked as expected on last build (few months ago)
    But now I tried to build it again, and get error that libaio1 could not be located

    #7 1.773 Reading package lists...
    #7 2.338 Reading package lists...
    #7 2.892 Building dependency tree...
    #7 3.031 Reading state information...
    #7 3.050 E: Unable to locate package libaio1
    #7 ERROR: process "/bin/sh -c apt-get update && apt-get install -y iputils-ping wget unzip libaio1" did not complete successfully: exit code: 100


    So I changed it to libaio1t64
    That took care of build problem, but now I have problem when Docker tries to run:

    File "/code/app/modules/database/databaseModel.py", line 7, in <module>
    oracledb.init_oracle_client()
    File "src/oracledb/impl/thick/utils.pyx", line 527, in oracledb.thick_impl.init_oracle_client
    File "src/oracledb/impl/thick/utils.pyx", line 562, in oracledb.thick_impl.init_oracle_client
    File "src/oracledb/impl/thick/utils.pyx", line 474, in oracledb.thick_impl._raise_from_info
    oracledb.exceptions.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libaio.so.1: cannot open shared object file: No such file or directory". See https://python-oracledb.readthedocs.io/en/latest/user_guide/initialization.html for help
    Help: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpi-1047


    Does anybody know how to resolve this issue?

    Continue reading...

Compartilhe esta Página