<p>Your problem in this case is very clear..</p>
<blockquote>
<p>2023-08-12 01:30:45.665974(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(<strong>HOST='host.host.host'</strong>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME='ADMTST')))DPY-6005: cannot connect to database. Connection failed with <strong>&quot;[Errno -2] Name does not resolve&quot;</strong></p>
</blockquote>
<p>Whatever that code is being called (in python), you're trying to connect to a database called <code>host.host.host</code>. That means under the hood something is trying to resolve <code>host.host.host</code> to an ip address. There is nothing on your network or in your hosts file that can resolve <code>host.host.host</code>.</p>

CC BY-SA 4.0
2023-08-13T19:34:25.360Z
2023-08-13T19:34:25.360Z
Evan Carroll
<p>When I inherently go to make the connection from the python app inside the docker file I get .. I can ping and nslookup from indide the docker container from the terminal....so I'm a bit confused..</p>
<blockquote>
<p>2023-08-12
01:30:45.665974(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST='host.host.host')(PORT=1521))(CONNECT_DATA=(SERVICE_NAME='ADMTST')))DPY-6005:
cannot connect to database. Connection failed with &quot;[Errno -2] Name
does not resolve&quot;</p>
</blockquote>
<p>Docker File:</p>
<pre><code>FROM python:3-alpine

WORKDIR /app
 
COPY requirements.txt .
COPY package.json .
RUN apk add openldap-dev
RUN apk update &amp;&amp; apk add python3-dev \
                        gcc \
                        libc-dev \
                        npm

RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN python3 -m pip install -U &quot;Cython&lt;3.0.0&quot;
RUN python3 -m pip install --no-build-isolation &quot;oracledb==1.2.2&quot;

RUN pip install -r requirements.txt

RUN npm install

COPY . .
RUN mv node_modules ./static/
EXPOSE 8000
CMD [&quot;gunicorn&quot;,&quot;--access-logfile&quot;,&quot;LOGS/access_logs&quot;,&quot;--error-logfile&quot;,&quot;LOGS/error_logs&quot;,&quot;--certfile&quot;,&quot;tempSSL/certificate.pem&quot;,&quot;--keyfile&quot;,&quot;tempSSL/server.key&quot;,&quot;--workers&quot;,&quot;4&quot;, &quot;-b&quot;, &quot;0.0.0.0:8000&quot;, &quot;wsgi:app&quot;]
</code></pre>
<p>Docker Compose</p>
<pre><code>version: '3.8'
services:
  app:
    build: .
    ports:
      - 8000:8000
      - 1521:1521
</code></pre>

<docker><python><network>
Can't get Python with cx_oracle to connect outbound to Oracle server
BostonMacOSX
# Can't get Python with cx_oracle to connect outbound to Oracle server

(Asked by: username_0 on 2023-08-12)

When I inherently go to make the connection from the python app inside the docker file I get .. I can ping and nslookup from indide the docker container from the terminal....so I'm a bit confused..

2023-08-12
01:30:45.665974(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST='host.host.host')(PORT=1521))(CONNECT_DATA=(SERVICE_NAME='ADMTST')))DPY-6005:
cannot connect to database. Connection failed with "[Errno -2] Name
does not resolve"

Docker File:
FROM python:3-alpine

WORKDIR /app
 
COPY requirements.txt .
COPY package.json .
RUN apk add openldap-dev
RUN apk update && apk add python3-dev \
                        gcc \
                        libc-dev \
                        npm

RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN python3 -m pip install -U "Cython<3.0.0"
RUN python3 -m pip install --no-build-isolation "oracledb==1.2.2"

RUN pip install -r requirements.txt

RUN npm install

COPY . .
RUN mv node_modules ./static/
EXPOSE 8000
CMD ["gunicorn","--access-logfile","LOGS/access_logs","--error-logfile","LOGS/error_logs","--certfile","tempSSL/certificate.pem","--keyfile","tempSSL/server.key","--workers","4", "-b", "0.0.0.0:8000", "wsgi:app"]

Docker Compose
version: '3.8'
services:
  app:
    build: .
    ports:
      - 8000:8000
      - 1521:1521

**Tags:** docker, python, network


---

## 1 answers

### Answer by username_1 on 2023-08-13. Score: 0

Your problem in this case is very clear..

> 2023-08-12 01:30:45.665974(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(**HOST='host.host.host'**)(PORT=1521))(CONNECT\_DATA=(SERVICE\_NAME='ADMTST')))DPY-6005: cannot connect to database. Connection failed with **"[Errno -2] Name does not resolve"**

Whatever that code is being called (in python), you're trying to connect to a database called `host.host.host`. That means under the hood something is trying to resolve `host.host.host` to an ip address. There is nothing on your network or in your hosts file that can resolve `host.host.host`.


---

