Why does a Swagger UI, managed by Docker, stop working? (ERR_CONNECTION_REFUSED)

887 views Asked by At

I'm working on a Docker related C# program.
Normally, when I launch it, it shows the Swagger UI, but this time, in the internet browser, I just see "localhost refused to connect", mentioning ERR_CONNECTION_REFUSED.

The so-called "details" are a joke:

Check your Internet connection
Check your network cables, modem, and routers.

Allow Microsoft Edge to access the network in your firewall or antivirus settings.
If it's already listed as a program allowed to access the network, try removing it from the list, and adding it again.

If you use a proxy server:
Check your proxy settings. You might need to ask your organization if the proxy server is working. If you don't think you should be using a proxy server, go to Settings > System > Open your computer's proxy settings

Just for being sure there's no problem with the "localhost" entry:

Commandline prompt>ping -a localhost

Pinging PORT-DDM.<servername> [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

There seems not to be a process, running on port 5128:

Commandline prompt>netstat -qon | findstr /I "5128"
=> no result

Commandline prompt>netstat -aon | findstr /I "5128"
=> no result

There are some other ports in the "neighbourhood" of 5128 in the general netstat -aon result:

...
TCP    [::]:3389   [::]:0   LISTENING   2012
TCP    [::]:5601   [::]:0   LISTENING   21660
TCP    [::]:5672   [::]:0   LISTENING   21660
...

Where 21660 is the PID of the so-called "Docker Desktop Backend".

As far as the rest of Docker is concerned: all containers are running, just like before.

Yesterday it was running fine, but today not. The only thing I've modified is a Windows update, currently I'm working with (winver result):

Windows 10
Version 21H2 (OS Build 19044.2486)

Oh, just in order to be sure: I have launched the following command:

Commandline prompt>docker-compose -f docker-compose.base.yml up

This did not solve the problem neither.

My /etc/hosts file (C:\Windows\System32\drivers\etc\hosts), viewed in Notepad++, looks as follows (modified today, according to the file's last modification date):

enter image description here

(Mind the bunch of Null characters at the beginning)

I have replaced this by:

# manually added localhost
127.0.0.1 localhost

# Added by Docker Desktop
10.1.xxx.xxx host.docker.internal
10.1.xxx.xxx gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

This did not solve the issue.

As far as the ASPNETCORE_ENVIRONMENT environment variable is concerned, this one is indeed set to "DEVELOPMENT", as you can see in the following container related information excerpt while debugging:

enter image description here

I just added two rules in my firewall, permitting the port 5128, inbound as well as outbound, it did not make a difference:

Inbound rule:

enter image description here

Outbound rule:

enter image description here

There are no proxy settings.

The result of docker ps for this particular container is the following (reworked for readability reasons):

Commandline prompt>docker ps

CONTAINER ID : e88e98a213ed
IMAGE        : image_svcapi:dev
COMMAND      : "tail -f /dev/null"
CREATED      : 5 days ago
STATUS       : Up 2 hours
PORTS        : 0.0.0.0:5128->80/tcp, 0.0.0.0:49154->443/tcp
NAMES        : Application_Svc.Api

Unfortunately, the command curl is not understood by my Docker container:

# curl http://localhost:80
/bin/sh: 3: curl: not found
# find / -name "curl"
find: '/proc/13748/task/13748/net': Invalid argument
find: '/proc/13748/net': Invalid argument
#

I tried apt install curl but I got the following error message:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package curl

(I get the same result for "libcurl" and "libcurl4-openssl-dev").

Outside, in a regular commandline, the curl command works and gives following result:

Commandline prompt>curl http://localhost:80
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>IIS Windows</title>
    <style type="text/css">
      <!--body { color:#000000;
                 background-color:#0072C6;
                 margin:0;}
      #container { margin-left:auto;
                   margin-right:auto;
                   text-align:center; }
      a img { border:none; }-->
    </style>
  </head>
  <body> <div id="container">
           <a href="http://go.microsoft.com/fwlink/?linkid=66318&amp;clcid=0x409">
             <img src="iisstart.png" alt="IIS" width="960" height="600"/>
           </a>
         </div>
  </body>
</html>

Does anybody have an idea?
Thanks in advance

0

There are 0 answers