This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

scheduler: Stop containers before booting new ones

Before this commit, if the join returned that a container with the same
IP needed to be restarted (i.e. there was a container to be killed and
a container to be booted with the same IP), the boot request would fail
because Docker doesn't allow two running containers to have the same IP.

While this currently doesn't happen because changes to container
attributes result in new IP addresses, the upcoming secret
implementation will result in containers restarting if their secret
value in Vault changes. When this happens, a new IP is not assigned,
triggering this bug.
  • Loading branch information...
kklin committed Oct 12, 2017
1 parent ca9e7e8 commit 798db2c5ebb806554002029451e0622f4a14bfeb
Showing with 1 addition and 1 deletion.
  1. +1 −1 minion/scheduler/worker.go
@@ -66,8 +66,8 @@ func runWorker(conn db.Conn, dk docker.Client, myIP string) {
}
start := time.Now()
doContainers(dk, toBoot, dockerRun)
doContainers(dk, toKill, dockerKill)
doContainers(dk, toBoot, dockerRun)
log.Infof("Scheduler spent %v starting/stopping containers",
time.Since(start))
}

0 comments on commit 798db2c

Please sign in to comment.