Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ExposedPorts for --net=host #268

Merged
merged 1 commit into from Sep 15, 2016
Merged

Conversation

@wrouesnel
Copy link
Contributor

@wrouesnel wrouesnel commented Oct 13, 2015

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 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 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

@wrouesnel wrouesnel commented Dec 1, 2015

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 albamc commented May 13, 2016

this patch is useful when you use macvlan modes too.

@josegonzalez
Copy link
Member

@josegonzalez josegonzalez commented Sep 15, 2016

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 :)

@josegonzalez josegonzalez merged commit db7c8bd into gliderlabs:master Sep 15, 2016
1 check passed
1 check passed
ci/circleci Your tests passed on CircleCI!
Details
This was referenced Jun 25, 2018
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.