94d70d83 |
package daemon
import ( |
818a5198 |
"fmt"
|
94d70d83 |
"github.com/docker/docker/container"
"github.com/docker/docker/libcontainerd"
)
// platformConstructExitStatus returns a platform specific exit status structure
func platformConstructExitStatus(e libcontainerd.StateInfo) *container.ExitStatus {
return &container.ExitStatus{
ExitCode: int(e.ExitCode),
}
} |
818a5198 |
// postRunProcessing perfoms any processing needed on the container after it has stopped.
func (daemon *Daemon) postRunProcessing(container *container.Container, e libcontainerd.StateInfo) error { |
2266e7f2 |
if e.ExitCode == 0 && e.UpdatePending { |
da92dad5 |
spec, err := daemon.createSpec(container)
if err != nil {
return err
}
|
78540d0d |
newOpts := []libcontainerd.CreateOption{&libcontainerd.ServicingOption{ |
da92dad5 |
IsServicing: true, |
78540d0d |
}}
copts, err := daemon.getLibcontainerdCreateOptions(container)
if err != nil {
return err
}
if copts != nil { |
606a245d |
newOpts = append(newOpts, copts...) |
da92dad5 |
}
// Create a new servicing container, which will start, complete the update, and merge back the
// results if it succeeded, all as part of the below function call. |
37a3be24 |
if err := daemon.containerd.Create((container.ID + "_servicing"), "", "", *spec, container.InitializeStdio, newOpts...); err != nil { |
dcfe9927 |
container.SetExitCode(-1) |
da92dad5 |
return fmt.Errorf("Post-run update servicing failed: %s", err)
} |
818a5198 |
}
return nil
} |