Make the algorithm follow docker-compose more precisely

https://github.com/v2tec/watchtower/pull/40#discussion_r97719974
pull/57/head
Tanguy ⧓ Herrmann 7 years ago
parent ce321242bf
commit a5c3e1e05a

@ -134,19 +134,12 @@ func (client dockerClient) StartContainer(c Container) error {
name := c.Name()
log.Infof("Starting %s", name)
log.Infof("Creating %s", name)
creation, err := client.api.ContainerCreate(bg, config, hostConfig, simpleNetworkConfig, name)
if err != nil {
return err
}
log.Debugf("Starting container %s (%s)", name, creation.ID)
err = client.api.ContainerStart(bg, creation.ID, types.ContainerStartOptions{})
if err != nil {
return err
}
for k := range simpleNetworkConfig.EndpointsConfig {
err = client.api.NetworkDisconnect(bg, k, creation.ID, true)
if err != nil {
@ -160,6 +153,14 @@ func (client dockerClient) StartContainer(c Container) error {
return err
}
}
log.Debugf("Starting container %s (%s)", name, creation.ID)
err = client.api.ContainerStart(bg, creation.ID, types.ContainerStartOptions{})
if err != nil {
return err
}
return nil
}

Loading…
Cancel
Save