lavie / runlike

Given an existing docker container, prints the command line necessary to run a copy of it.
Other
1.99k stars 118 forks source link

Exposed port to multiple addresses: only one IP address shows up #113

Closed bfejervari closed 1 month ago

bfejervari commented 7 months ago

I have a docker container (FreeIPA), which has it's DNS server port (:53) exposed to 127.0.0.1 and 192.168.200.8 addresses. The docker run command part:

    -p 127.0.0.1:53:53 -p 127.0.0.1:53:53/udp \
    -p 192.168.200.8:53:53 -p 192.168.200.8:53:53/udp \

The same part in the docker inspect output:

                "53/tcp": [
                    {   
                        "HostIp": "127.0.0.1",
                        "HostPort": "53"
                    },
                    {   
                        "HostIp": "192.168.200.8",
                        "HostPort": "53"
                    }
                ],
                "53/udp": [
                    {   
                        "HostIp": "127.0.0.1",
                        "HostPort": "53"
                    },
                    {   
                        "HostIp": "192.168.200.8",
                        "HostPort": "53"
                    }
                ],

The problem: using runlike shows only the first IP address as a -p ... parameter.

lavie commented 7 months ago

Indeed it seems runlike only uses the first item in the list: https://github.com/lavie/runlike/blob/1e5a8a279f48d5ab95b04d4e5ce81bfe80d7708b/runlike/inspector.py#L109

A good first issue to try to solve if someone wants to have a crack at this. Thank you for reporting!

ByteBaker commented 1 month ago

@lavie I've verified that this problem no longer exists.

Docker run: docker run --name ubuntu -p 127.0.0.1:53:53 -p 127.0.0.1:53:53/udp -d ubuntu sleep infinity

Runlike output: docker run --name=ubuntu --hostname=a4fee37b7072 --mac-address=<redacted> --network=bridge -p 127.0.0.1:53:53 -p 127.0.0.1:53:53/udp --runtime=runc --detach=true ubuntu sleep infinity

The issue can be closed now.

lavie commented 1 month ago

Indeed it was recently solved by a contributor probably in this PR: https://github.com/lavie/runlike/pull/116 Thank you for noticing. Will close this now.