Fix autostart for swarm scope connected containers

The swarm scope network connected containers with autostart enabled
there was a dependency problem with the cluster to be initialized before
we can autostart them. With the current container restart code happening
before cluster init, these containers were not getting autostarted
properly. Added a fix to delay the container start of those containers
which has atleast one swarm scope endpoint to until after the cluster is
initialized.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Upstream-commit: c9fb551d60584ac4ad01561e2f56b7b7cc9483b9
Component: engine
This commit is contained in:
Jana Radhakrishnan
2016-09-09 09:55:57 -07:00
parent 32b3a84313
commit 293cb24e33
6 changed files with 92 additions and 10 deletions

View File

@ -262,6 +262,11 @@ func (cli *DaemonCli) start(opts daemonOptions) (err error) {
logrus.Fatalf("Error creating cluster component: %v", err)
}
// Restart all autostart containers which has a swarm endpoint
// and is not yet running now that we have successfully
// initialized the cluster.
d.RestartSwarmContainers()
logrus.Info("Daemon has completed initialization")
logrus.WithFields(logrus.Fields{