2018-02-05 21:05:59 +00:00
|
|
|
package libcontainerd // import "github.com/docker/docker/libcontainerd"
|
2016-03-18 18:53:27 +00:00
|
|
|
|
2017-09-08 20:35:01 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
2017-09-22 13:52:41 +00:00
|
|
|
"syscall"
|
|
|
|
|
2017-09-08 20:35:01 +00:00
|
|
|
opengcs "github.com/Microsoft/opengcs/client"
|
|
|
|
)
|
2016-03-18 18:53:27 +00:00
|
|
|
|
2016-08-29 10:37:14 +00:00
|
|
|
// setupEnvironmentVariables converts a string array of environment variables
|
2016-03-18 18:53:27 +00:00
|
|
|
// into a map as required by the HCS. Source array is in format [v1=k1] [v2=k2] etc.
|
|
|
|
func setupEnvironmentVariables(a []string) map[string]string {
|
|
|
|
r := make(map[string]string)
|
|
|
|
for _, s := range a {
|
2016-09-04 22:44:13 +00:00
|
|
|
arr := strings.SplitN(s, "=", 2)
|
2016-03-18 18:53:27 +00:00
|
|
|
if len(arr) == 2 {
|
|
|
|
r[arr[0]] = arr[1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return r
|
|
|
|
}
|
2016-04-13 20:34:07 +00:00
|
|
|
|
2017-08-01 18:57:50 +00:00
|
|
|
// Apply for the LCOW option is a no-op.
|
|
|
|
func (s *LCOWOption) Apply(interface{}) error {
|
|
|
|
return nil
|
|
|
|
}
|
2017-09-08 20:35:01 +00:00
|
|
|
|
2017-09-08 00:02:17 +00:00
|
|
|
// debugGCS is a dirty hack for debugging for Linux Utility VMs. It simply
|
2017-09-08 20:35:01 +00:00
|
|
|
// runs a bunch of commands inside the UVM, but seriously aides in advanced debugging.
|
|
|
|
func (c *container) debugGCS() {
|
|
|
|
if c == nil || c.isWindows || c.hcsContainer == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
cfg := opengcs.Config{
|
|
|
|
Uvm: c.hcsContainer,
|
|
|
|
UvmTimeoutSeconds: 600,
|
|
|
|
}
|
|
|
|
cfg.DebugGCS()
|
|
|
|
}
|
2017-09-22 13:52:41 +00:00
|
|
|
|
|
|
|
// containerdSysProcAttr returns the SysProcAttr to use when exec'ing
|
|
|
|
// containerd
|
|
|
|
func containerdSysProcAttr() *syscall.SysProcAttr {
|
|
|
|
return nil
|
|
|
|
}
|