From a042e5a20a7801efc936daf7a639487bb37ca966 Mon Sep 17 00:00:00 2001 From: Abhinandan Prativadi Date: Mon, 8 Jan 2018 14:25:50 -0800 Subject: [PATCH] Disable service on release network This PR contains a fix for moby/moby#30321. There was a moby/moby#31142 PR intending to fix the issue by adding a delay between disabling the service in the cluster and the shutdown of the tasks. However disabling the service was not deleting the service info in the cluster. Added a fix to delete service info from cluster and verified using siege to ensure there is zero downtime on rolling update of a service.In order to support it and ensure consitency of enabling and disable service knob from the daemon, we need to ensure we disable service when we release the network from the container. This helps in making the enable and disable service less racy. The corresponding part of libnetwork fix is part of docker/libnetwork#1824 Signed-off-by: abhi --- daemon/container_operations.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/container_operations.go b/daemon/container_operations.go index 1a1c7c4b3f..3900e95e8d 100644 --- a/daemon/container_operations.go +++ b/daemon/container_operations.go @@ -966,6 +966,9 @@ func (daemon *Daemon) releaseNetwork(container *container.Container) { logrus.Warnf("error locating sandbox id %s: %v", sid, err) return } + if err := sb.DisableService(); err != nil { + logrus.WithFields(logrus.Fields{"container": container.ID, "sandbox": sid}).WithError(err).Error("Error removing service from sandbox") + } if err := sb.Delete(); err != nil { logrus.Errorf("Error deleting sandbox id %s for container %s: %v", sid, container.ID, err)