Luís de Sousa
Luís de Sousa

Reputation: 6841

Docker containers do not reply to client applications in the host

I have been working with a container running Virtuoso. Suddenly it stopped accepting connections from the host:

$ docker ps
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS                                            NAMES
67cd6e01c2fa        openlink/virtuoso-opensource-7:latest   "/virtuoso-entrypoin…"   19 minutes ago      Up About a minute   0.0.0.0:1111->1111/tcp, 0.0.0.0:8890->8890/tcp   virtdb

$ isql 1111
[ISQL]ERROR: Could not SQLConnect

The service remains up and can be accessed from within the container itself:

$ docker exec -it 67cd6e01c2fa /bin/bash
root@67cd6e01c2fa:/opt/virtuoso-opensource/database# isql 1111
OpenLink Virtuoso Interactive SQL (Virtuoso)
Version 07.20.3230 as of Feb  4 2020
Type HELP; for help and EXIT; to exit.

*** Error 28000: [Virtuoso Driver]CL034: Bad login
at line 0 of Top-Level:


Enter password for dba :
Connected to OpenLink Virtuoso
Driver: 07.20.3230 OpenLink Virtuoso ODBC Driver
SQL> 

As far as I can understand, the port forwarding seems to be working, but no replies are recieved by the host:

$ sudo netstat -tunlp | grep 1111
tcp6       0      0 :::1111                 :::*                    LISTEN      132530/docker-proxy

I then tried other images, but they all behave in the same way. Here is a simple example with nginx:

$ docker run -d -p 8081:80 nginx:alpine
Unable to find image 'nginx:alpine' locally
alpine: Pulling from library/nginx
188c0c94c7c5: Pull complete 
0ca72de6f957: Pull complete 
9dd8e8e54998: Pull complete 
f2dc206a393c: Pull complete 
85defa007a8b: Pull complete 
Digest: sha256:9b22bb6d703d52b079ae4262081f3b850009e80cd2fc53cdcb8795f3a7b452ee
Status: Downloaded newer image for nginx:alpine
ebbfa6f9cf644465fb4aec9c29faecef7b81d57474bb11d698853095e7c5a144

$ docker ps
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS                                            NAMES
ebbfa6f9cf64        nginx:alpine                            "/docker-entrypoint.…"   8 seconds ago       Up 5 seconds        0.0.0.0:8081->80/tcp                             cranky_roentgen

$ curl http://localhost:8081
curl: (56) Recv failure: Connection reset by peer

Using the container IP does not fix it either:

$ docker inspect -f \
> '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \
> ebbfa6f9cf64
172.17.0.3

$ curl http://172.17.0.3:8081
curl: (28) Failed to connect to 172.17.0.3 port 8081: Connection timed out

With a bit more information from wget:

$ wget 0.0.0.0:8081
--2020-11-10 17:57:50--  http://0.0.0.0:8081/
Connecting to 0.0.0.0:8081... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2020-11-10 18:00:01--  (try: 2)  http://0.0.0.0:8081/
Connecting to 0.0.0.0:8081... connected.
HTTP request sent, awaiting response... ^C

What is going wrong?

Upvotes: 1

Views: 144

Answers (1)

Luís de Sousa
Luís de Sousa

Reputation: 6841

I tried many different things, changing ports, alternative image versions, changing application settings, but this problem prevailed. Eventually I purged docker from the system and re-installed it, and container ports became responsive again. Does not make sense, but fixed it.

Upvotes: 1

Related Questions