Skip to content

Instantly share code, notes, and snippets.

@stefanschneider
Created August 28, 2015 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanschneider/a001ee7a39db7e9b6f96 to your computer and use it in GitHub Desktop.
Save stefanschneider/a001ee7a39db7e9b6f96 to your computer and use it in GitHub Desktop.
// hcs-test project main.go
package main
/*
Docker daemon is running in debug mode under win 2016 TP3.
Reading the logs can provide some insight in how the docker is using the
windows execdriver (and other drivers related to images and networks)
cat "c:\ProgramData\docker\daemon.log"
*/
import (
"fmt"
"github.com/microsoft/hcsshim"
"github.com/docker/docker/daemon/execdriver"
// run this if there are compilation errors relation docker verion in autogen:
// go get github.com/akavel/rsrc
// bash hack/make/.go-autogen
"github.com/docker/docker/daemon/execdriver/execdrivers"
)
func main() {
bi, e := hcsshim.GetSharedBaseImages()
fmt.Println(bi)
fmt.Println(e)
cape := execdriver.GetAllCapabilities()
fmt.Println(cape)
winExDriver, err := execdrivers.NewDriver("windows", []string{}, "C:\\ProgramData\\docker", "", "C:\\Windows\\System32\\docker.exe", nil)
fmt.Println(winExDriver, err)
command := execdriver.Command{
ID: "myconainert",
ProcessConfig: execdriver.ProcessConfig{
Entrypoint: "cmd",
},
Resources: &execdriver.Resources{},
Network: &execdriver.Network{},
}
pipes := execdriver.Pipes{
}
winExDriver.Run(&command, &pipes, func(pconf *execdriver.ProcessConfig, pid int){
fmt.Println(pconf, pid)
})
}
/*
> docker status
Csontainers: 2
Images: 1
Storage Driver: windowsfilter
Windows:
Execution Driver: Windows 1854 1.9.0-dev 4376380
Logging Driver: json-file
Kernel Version: 10.0 10514 (10514.0.amd64fre.th2_release.150808-1529)
Operating System: Windows Server 2016 Technical Preview 3
CPUs: 1
Total Memory: 3.5 GiB
Name: CONTAINER-TEST
ID: F2Y3:NGP6:L27H:25BT:Y5UO:XPMU:MZTS:6SST:GBHT:4L5C:5NYN:POAY
Debug mode (server): true
File Descriptors: -1
Goroutines: 31
System Time: 2015-08-28T09:43:53.6311557Z
EventsListeners: 0
Init SHA1:
Init Path: C:\Windows\System32\docker.exe
Docker Root Dir: C:\ProgramData\docker
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment