Skip to content

Commit

Permalink
Merge pull request #448 from raymondelooff/bugfix/188
Browse files Browse the repository at this point in the history
Unset Hostname when NetworkMode is container
  • Loading branch information
simskij committed Feb 8, 2020
2 parents af5d175 + fde6e73 commit bd1b3c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/container/container.go
Expand Up @@ -138,6 +138,7 @@ func (c Container) StopSignal() string {
// the options overridden at runtime.
func (c Container) runtimeConfig() *dockercontainer.Config {
config := c.containerInfo.Config
hostConfig := c.containerInfo.HostConfig
imageConfig := c.imageInfo.Config

if config.WorkingDir == imageConfig.WorkingDir {
Expand All @@ -148,6 +149,10 @@ func (c Container) runtimeConfig() *dockercontainer.Config {
config.User = ""
}

if hostConfig.NetworkMode.IsContainer() {
config.Hostname = ""
}

if util.SliceEqual(config.Cmd, imageConfig.Cmd) {
config.Cmd = nil
}
Expand Down

0 comments on commit bd1b3c1

Please sign in to comment.