mirror of
https://github.com/containers/podman.git
synced 2025-12-01 10:38:05 +08:00
Merge pull request #24164 from mheon/host_network_no_expose_in_ports
Exposed ports are only included when not --net=host
This commit is contained in:
@@ -211,7 +211,11 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver
|
||||
return nil, err
|
||||
}
|
||||
data.NetworkSettings = networkConfig
|
||||
addInspectPortsExpose(c.config.ExposedPorts, data.NetworkSettings.Ports)
|
||||
// Ports in NetworkSettings includes exposed ports for network modes that are not host,
|
||||
// and not container.
|
||||
if !(c.config.NetNsCtr != "" || c.NetworkMode() == "host") {
|
||||
addInspectPortsExpose(c.config.ExposedPorts, data.NetworkSettings.Ports)
|
||||
}
|
||||
|
||||
inspectConfig := c.generateInspectContainerConfig(ctrSpec)
|
||||
data.Config = inspectConfig
|
||||
|
||||
Reference in New Issue
Block a user