0

I am on a Fedora 29, and I tried both with fedora upstream package (docker version 1.13.1-67) and with docker-ci repository (version 18.09.6), but the issue is still here.

It does not matter if I am exposing a port (e.g. -p 8000:8000) or using host network (--net=host). (edit that is, the effect is the same: I cannot connect.)

So, I start any service, say netcat in alpine:

$ docker run -it --rm --net=host alpine /usr/bin/nc -l 8000

Well, I cannot connect to it:

$ nc 127.0.0.1 8000
Ncat: Connection refused.

What I find curious is that I can see the nc process in netstat:

# netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:40983           0.0.0.0:*               LISTEN      3379/nc

And if I kill that process (3379), the docker container dies as expected, but I cannot send data over that port

$ nc 127.0.0.1 40983
hello
there
Ncat: Broken pipe.

The networking section of docker inspect looks good to me

    "NetworkSettings": {                                                                                                        
        "Bridge": "",                                                                                                      
        "SandboxID": "4d7b92d489a8d310dedc15d47aaf2224f8488300cefd5e398798fef35b84f5a5",                             
        "HairpinMode": false,                                                                                                                                                          
        "LinkLocalIPv6Address": "",                                                   
        "LinkLocalIPv6PrefixLen": 0,                   
        "Ports": {},     
        "SandboxKey": "/var/run/docker/netns/default",                                                                                                                                                 
        "SecondaryIPAddresses": null, 
        "SecondaryIPv6Addresses": null,                                                                                     
        "EndpointID": "",                                                                                                
        "Gateway": "",                                                                                                 
        "GlobalIPv6Address": "",                                                   
        "GlobalIPv6PrefixLen": 0,                                                     
        "IPAddress": "",                                                                
        "IPPrefixLen": 0,                                                                       
        "IPv6Gateway": "",                                                                       
        "MacAddress": "",                                                            
        "Networks": {                                                                 
            "host": {                                   
                "IPAMConfig": null,
                "Links": null,          
                "Aliases": null,               
                "NetworkID": "63ba5fdccf7b27b3cfc7062e799ff0d4e294ae087bee0ebc81e2df705a430127",                             
                "EndpointID": "f5738ec1e102d8073fc273458da45bf15dc034c6cd239383b88386c09f880c28",                                       
                "Gateway": "",                          
                "IPAddress": "", 
                "IPPrefixLen": 0,                                              
                "IPv6Gateway": "",                                           
                "GlobalIPv6Address": "",        
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": "",
                "DriverOpts": null
            }                   
        }                 
    }

What is wrong here? How can I check what is going on?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.