Ensure containers are stopped on daemon startup#35805
Ensure containers are stopped on daemon startup#35805anusha-ragunathan merged 1 commit intomoby:masterfrom
Conversation
|
LGTM |
|
Seeing failures: |
da15ad0 to
5d7041c
Compare
|
Tested this and it doesnt work. After daemon restart, |
|
Adding a index 96b39e8..c18379b 100644
--- a/daemon/daemon.go
+++ b/daemon/daemon.go
@@ -44,6 +44,7 @@ import (
"github.com/docker/docker/pkg/containerfs"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/plugingetter"
+ "github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/sysinfo"
"github.com/docker/docker/pkg/system"
"github.com/docker/docker/pkg/truncindex"
@@ -241,12 +242,19 @@ func (daemon *Daemon) restore() error {
logrus.Errorf("Failed to restore container %s with containerd: %s", c.ID, err)
return
}
- if !alive {
+
+ if !daemon.configStore.LiveRestoreEnabled {
+ err = daemon.containerd.SignalProcess(context.Background(), c.ID, libcontainerd.InitProcessName, int(signal.SignalMap["TERM"]))
+ logrus.WithError(err).Errorf("Failed to kill container %v due to %v", c.ID, err)
+ }
+
+ if !alive || !daemon.configStore.LiveRestoreEnabled {
ec, exitedAt, err = daemon.containerd.DeleteTask(context.Background(), c.ID)
if err != nil && !errdefs.IsNotFound(err) {
logrus.WithError(err).Errorf("Failed to delete container %s from containerd", c.ID)
return
}
+ alive = false
}
if c.IsRunning() || c.IsPaused() { |
ebd6a08 to
c2f3b3b
Compare
daemon/daemon.go
Outdated
There was a problem hiding this comment.
if !daemon.configStore.LiveRestoreEnabled, am I missing something?
There was a problem hiding this comment.
Yes, you are correct...
|
Just saw failure on experimental build job: |
|
https://jenkins.dockerproject.org/job/Docker-PRs-experimental/38431/console |
ea89a1e to
e0cdd4f
Compare
|
experimental CI failure is unrelated and is tracked in #35825 |
There was a problem hiding this comment.
The daemon is not started yet. So remove defer d.Stop
When the containerd 1.0 runtime changes were made, we inadvertantly removed the functionality where any running containers are killed on startup when not using live-restore. This change restores that behavior. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
e0cdd4f to
e69127b
Compare
|
LGTM (Once CI is green) |
seemethere
left a comment
There was a problem hiding this comment.
LGTM on green as well
When the containerd 1.0 runtime changes were made, we inadvertently
removed the functionality where any running containers are killed on
startup when not using live-restore.
This change restores that behavior.
ping @fcrisciani