Public | Automated Build

Last pushed: 9 months ago
Short Description
CentOS 6.8, Python3.4.5, Oracle Instant Client 11.2.0.4.0-1 and Python cx_Oracle extension
Full Description

python3_cx-oracle

Dockerfile to create container including CentOS 6.8, Python3.4.5, Oracle Instant Client 11.2.0.4.0-1, Python cx_Oracle extension

Usage 1 - for simple scripts:

  • prepare "tnsnames.ora" file
    <NET_SERVICE_NAME> =
    (DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = <ORACLE_SERVER_ADDRESS>)(PORT = 1521))
     )
    (CONNECT_DATA =
     (SERVICE_NAME = <ORACLE_SERVICE_NAME>)
    )
    )
    
  • write python code
    ```
    import cx_Oracle
    ...

con = cx_Oracle.connect("<USERNAME>/<PASSWORD>@<NET_SERVICE_NAME>")
...

- run docker container for simple scripts

docker run -it --rm --name <CONTAINER NAME> -v "$PWD"/tnsnames.ora:/usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora -v "$PWD":/usr/src/myapp -w /usr/src/myapp chenshenyou/python3_cx-oracle python3 <PYTHON SCRIPT> <SCRIPT PARAMETERS>



**Usage 2 - create a Dockerfile**:

FROM chenshenyou/python3_cx-oracle:1.0

...

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY tnsnames.ora /usr/lib/oracle/11.2/client64/network/admin/

COPY requirements.txt /usr/src/app/
RUN pip3 install --no-cache-dir -r requirements.txt

COPY . /usr/src/app

ENTRYPOINT ["python3", "<PYTHON SCRIPT>"]

```

References:

Docker Pull Command
Owner
chenshenyou
Source Repository

Comments (0)