monitor_windows.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package daemon
  2. import (
  3. "fmt"
  4. "github.com/docker/docker/container"
  5. "github.com/docker/docker/libcontainerd"
  6. )
  7. // platformConstructExitStatus returns a platform specific exit status structure
  8. func platformConstructExitStatus(e libcontainerd.StateInfo) *container.ExitStatus {
  9. return &container.ExitStatus{
  10. ExitCode: int(e.ExitCode),
  11. }
  12. }
  13. // postRunProcessing perfoms any processing needed on the container after it has stopped.
  14. func (daemon *Daemon) postRunProcessing(container *container.Container, e libcontainerd.StateInfo) error {
  15. if e.ExitCode == 0 && e.UpdatePending {
  16. spec, err := daemon.createSpec(container)
  17. if err != nil {
  18. return err
  19. }
  20. servicingOption := &libcontainerd.ServicingOption{
  21. IsServicing: true,
  22. }
  23. // Create a new servicing container, which will start, complete the update, and merge back the
  24. // results if it succeeded, all as part of the below function call.
  25. if err := daemon.containerd.Create((container.ID + "_servicing"), *spec, servicingOption); err != nil {
  26. container.SetExitCode(-1)
  27. return fmt.Errorf("Post-run update servicing failed: %s", err)
  28. }
  29. }
  30. return nil
  31. }