0

I'm running docker container using below command and this container's host is in the internal private network.

docker run --restart always --name srs2 -d -p 1935:1935 -p 1985:1985 -p 8080:8080 -p 8000:8000/udp -p 10080:10080/udp ossrs/srs:5

I need to access container's 8080 port from the external hosts and i've set port forwarding in my router config page as 28080:8080. With this setup i expect i can access container using 28080 port but this not even allows me to start tcp handshake(SYN packet is not reaching).

I should mention that it is possible to access other ports(not in the container) of host without any issue. So there is no issue on port forwarding setup. Also it is possible that accessing container from other hosts in the same private network but not external.

The below is the output of docker inspect

"NetworkSettings": {
            "Bridge": "",
            "SandboxID": "59c04190dbc0ee6f24b8e48a3e3e4ac927995c35ebb00bdef057b4ab0887d025",
            "SandboxKey": "/var/run/docker/netns/59c04190dbc0",
            "Ports": {
                "10080/udp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "10080"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "10080"
                    }
                ],
                "1935/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "1935"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "1935"
                    }
                ],
                "1985/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "1985"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "1985"
                    }
                ],
                "5060/tcp": null,
                "8000/udp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "8000"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "8000"
                    }
                ],
                "8080/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "8080"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "8080"
                    }
                ],
                "9000/tcp": null
            }

1 Answer 1

0

It was router problem. I borrowed raspberry pi(docker host) from my friend and there is router settings for my friend's network which is more specific than mine. So the port-forwarded requests goes to more specific router thus never reaching mine.

$ ip route
default via 192.168.219.1 dev eth0 proto static metric 100
default via 192.168.0.1 dev eth0 proto static metric 100
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.0.0/16 dev eth0 proto kernel scope link src 192.168.219.202 metric 100
192.168.219.0/24 dev eth0 proto kernel scope link src 192.168.219.202 metric 100

192.168.219.1 is friend's router which is more specific. After deleting it all works!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .