Skip to content

Conversation

@wrouesnel
Copy link
Contributor

Simple change to support the fact that docker no longer fills out mapped ports when run in --net=host mode. This instead simply reads all exposed ports and fills out the relevant service structure, restoring the original functionality.

Fixes #159

@ghostbar
Copy link

ghostbar commented Nov 3, 2015

This is a very simple patch, I tested it and it's working. Please merge.

@mgood
Copy link
Contributor

mgood commented Dec 1, 2015

Thanks for looking into this, but what about containers that are not run with --net=host? From what I'm seeing in the API, ExposedPorts may work for --net=host now, though in other cases wouldn't you still need to use PortBindings in order to register the ports that are bound to the Docker bridge?

@wrouesnel
Copy link
Contributor Author

ExposedPorts is always populated with the port number exposed on the host of any port (at least on Docker 1.9 on my laptop here).

If I run docker run -p 220:22000 -it debian /bin/bash, then I get

        "ExposedPorts": {
            "22000/tcp": {}
        },

back from docker inspect.

@albamc
Copy link

albamc commented May 13, 2016

this patch is useful when you use macvlan modes too.

@josegonzalez
Copy link
Member

This looks good to me. @MattAitchison can you give this a quick glance and tell me I'm not being dumb? It's mergeable otherwise :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants