1
0
mirror of https://github.com/containrrr/watchtower.git synced 2024-12-15 09:14:13 +02:00

Reuse the network config for the relaunch

This commit is contained in:
Tanguy ⧓ Herrmann 2016-12-17 22:50:36 +01:00
parent 96466dbcf7
commit fe0e34e857

View File

@ -8,6 +8,7 @@ import (
log "github.com/Sirupsen/logrus"
dockerclient "github.com/docker/docker/client"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"golang.org/x/net/context"
)
@ -118,10 +119,11 @@ func (client dockerClient) StartContainer(c Container) error {
bg := context.Background();
config := c.runtimeConfig()
hostConfig := c.hostConfig()
networkConfig := &network.NetworkingConfig{EndpointsConfig: c.containerInfo.NetworkSettings.Networks}
name := c.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 {
return err
}