github.com/kinvolk/docker@v1.13.1/daemon/monitor_windows.go (about)

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