How to avoid a connection refused error on an API with Visual Studio and a docker container?

  docker, http, networking, visual-studio

Since the containment I am working from home with the use of a VPN and I am not able to request an Authentication API for my solution.

I am working on a .Net Core application with two docker container, one is the application the second is the DB2 database and we have an Authentication API the client gave us that we installed on one of our local machine. So everything is currently in the same network once I am connecting through the VPN I guess (I am not a network expert).

Right now, the develop branch is working on the integration server and on my coworker’s PC and he is also working from home through the VPN so we are in the same conditions with the same code.
But I have this error when trying to authenticate :

Connection refused error

The only difference should come from my environment then and I have something different indeed :
– his environment

His configuration

And mine :

enter image description here

As you can see, I have http_proxy configured and I don’t know from where it is coming. It keeps the docker container from getting access to internet so I removed it with a export http_proxy= and was then able to retrieve the ping package with apt-get install iputils-ping.
With this configuration I can ping 8.8.8.8, ping the local machine where the API is installed, I can even curl the http authentication URL but I am still unable to connect when trying to launch the authentication on the app or the swagger.
I think the problem is located somewhere between the Visual Studio environment/configuration, the docker containers and the network but I can’t found out where.

Here is my docker-compose.yml :

version: '3.4'

services:
  db2server:
    env_file: .DB2env_file
    privileged: true
    build:
      context: .DB2
    ports:
      - 50001:50001
      - 55001:55001
    volumes:
      - .DB2data:/database
      - .DB2scripts:/var/setup
      - .DB2sql:/var/sql
  openhostservice:
    build:
      context: .
      dockerfile: OpenHostService/Dockerfile
    image: ${DOCKER_REGISTRY-}openhostservice
    depends_on:
      - db2server
    ports:
      - 32780:80
networks:
    default:
        external:
            name: ******

I tried with and without our proxy configuration on the global Windows system setting, with and without http_proxy.

Source: StackOverflow

LEAVE A COMMENT