mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 06:06:38 +01:00
Reuse the network config for the relaunch
This commit is contained in:
parent
96466dbcf7
commit
fe0e34e857
1 changed files with 3 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import (
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
dockerclient "github.com/docker/docker/client"
|
dockerclient "github.com/docker/docker/client"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/network"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -118,10 +119,11 @@ func (client dockerClient) StartContainer(c Container) error {
|
||||||
bg := context.Background();
|
bg := context.Background();
|
||||||
config := c.runtimeConfig()
|
config := c.runtimeConfig()
|
||||||
hostConfig := c.hostConfig()
|
hostConfig := c.hostConfig()
|
||||||
|
networkConfig := &network.NetworkingConfig{EndpointsConfig: c.containerInfo.NetworkSettings.Networks}
|
||||||
name := c.Name()
|
name := c.Name()
|
||||||
|
|
||||||
log.Infof("Starting %s", name)
|
log.Infof("Starting %s", name)
|
||||||
creation, err := client.api.ContainerCreate(bg, config, hostConfig, nil, name)
|
creation, err := client.api.ContainerCreate(bg, config, hostConfig, networkConfig, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue