WIP: No publishing ports#254
Conversation
When tsdproxy can talk to internal ports of the container, there is no need to publish the port to host machine.
almeidapaulopt
left a comment
There was a problem hiding this comment.
Thank you for this contribution, @castorinop! Supporting host network mode is definitely a valuable feature.\n\nI noticed this PR is marked as WIP in the title. Here are my observations from the review:\n\n### What it does:\n- Uses dcontainer.Config.ExposedPorts (container-level) in addition to HostConfig.PortBindings (host-level) for port detection\n- This allows containers in host network mode to work without published port bindings\n\n### Concerns:\n1. Removed early error check — The original code had if internalPort == "" && publishedPort == "" { return error } which was an early guard. Removing this means errors might surface later in less clear ways.\n2. Changed auto-detect condition — if c.autodetect → if c.autodetect || internalPort != "" — this means autodetect runs for ALL containers with an internal port, even when autodetect is disabled. Is that intentional?\n3. Changed fallback condition — if publishedPort == "" → if internalPort == "" || publishedPort == "" — this changes the fallback logic significantly.\n\nSince this is WIP, would you like to continue working on it? I think the approach is sound but the edge cases need more careful handling. Happy to provide more detailed feedback once you're ready! 🙂
b720a3f to
28506e0
Compare
work well running on host network mode.
avoid need export ports.