0

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

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.