1

I am running my python Flask project inside of the docker container and all the requests work fine, when I turn on the aws vpn client in order to connect to an external service I get an error:

urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

I get this error while making the /login request inside of my application.

Here is the docker compose service (Dockerfile is also super basic):

services:
  api:
    image: app
    build:
      context: .
      dockerfile: docker/Dockerfile.local
    env_file: ./docker/.env
    environment:
      <<: *environment-vars
    ports:
      - "8888:3000"
    command: bash -c "migrate && python wsgi.py"

Please help me to figure out what is wrong. I tried to reinstall the whole docker-machine and restarted everything nothing helped.

  • 1
    Do you just get this error with this endpoint? Are other of your requests Ok? Do you use a special service for your authentication? – Javad Nov 04 '22 at 19:22
  • 1
    Thank you @Javad, for your questions! I get this error for all of the endpoints that requires authorization and I use OAuth external service for authentication – Gaziza Yestemirova Nov 04 '22 at 19:28

1 Answers1

0

Based on urllib.error.URLError [python-docs]

The reason for this error. It can be a message string or another exception instance.

And the Temporary failure in name resolution error occurs when the system(or in your case your docker container) cannot translate a website name into an IP address. While the error sometimes appears due to a lost internet connection, there are multiple reasons why it may show up on your system when you turn on your vpn client to connect to the oauth external service.

So the error you mentioned is not about your Flask service and this is a network issue to troubleshoot. Probably you don't have a ping of the DNS of your OAuth service you can check it with:

ping example.com

And probably you got Temporary failure in name resolution again.

Here are some instructions you can follow in your docker container, I hope this helps you.

Javad
  • 2,033
  • 3
  • 13
  • 23