mirror of
https://github.com/containrrr/watchtower.git
synced 2024-12-12 09:04:17 +02:00
Unset Hostname when NetworkMode is container
The hostname can not be set on containers using a container network stack
This commit is contained in:
parent
af5d175e9f
commit
fde6e73077
@ -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 {
|
||||
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user