Skip to content

Commit

Permalink
network host should work (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathants authored Dec 15, 2020
1 parent 6858d97 commit fa8ef5e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,9 @@ func (i *Inspector) RunContainer() error {
}

errutil.FailWhen(i.ContainerInfo.NetworkSettings == nil, "docker-slim: error => no network info")
errutil.FailWhen(len(i.ContainerInfo.NetworkSettings.Ports) < len(commsExposedPorts), "docker-slim: error => missing comms ports")
if containerOptions.HostConfig.NetworkMode != "host" {
errutil.FailWhen(len(i.ContainerInfo.NetworkSettings.Ports) < len(commsExposedPorts), "docker-slim: error => missing comms ports")
}
i.logger.Debugf("RunContainer: container NetworkSettings.Ports => %#v", i.ContainerInfo.NetworkSettings.Ports)

if len(i.ContainerInfo.NetworkSettings.Ports) > 2 {
Expand Down Expand Up @@ -765,7 +767,7 @@ func (i *Inspector) initContainerChannels() error {
var cmdPort string
var evtPort string

if i.InContainer {
if i.InContainer || i.Overrides.Network == "host" {
targetHost = i.ContainerInfo.NetworkSettings.IPAddress
cmdPort = cmdPortStrDefault
evtPort = evtPortStrDefault
Expand Down

0 comments on commit fa8ef5e

Please sign in to comment.