Browse code

Windows: --hostname support

This passes through the container hostname to HCS, which in Windows Server
2016 TP4 will set the container's hostname in the registry before starting
it. This will be silently ignored by TP3.

Signed-off-by: John Starks <jostarks@microsoft.com>

John Starks authored on 2015/09/22 06:39:28
Showing 3 changed files
... ...
@@ -130,6 +130,7 @@ func populateCommand(ctx context.Context, c *Container, env []string) error {
130 130
 		FirstStart:     !c.HasBeenStartedBefore,
131 131
 		LayerFolder:    layerFolder,
132 132
 		LayerPaths:     layerPaths,
133
+		Hostname:       c.Config.Hostname,
133 134
 	}
134 135
 
135 136
 	return nil
... ...
@@ -220,4 +220,5 @@ type Command struct {
220 220
 	FirstStart         bool              `json:"first_start"`
221 221
 	LayerPaths         []string          `json:"layer_paths"` // Windows needs to know the layer paths and folder for a command
222 222
 	LayerFolder        string            `json:"layer_folder"`
223
+	Hostname           string            `json:"hostname"` // Windows sets the hostname in the execdriver
223 224
 }
... ...
@@ -72,6 +72,7 @@ type containerInit struct {
72 72
 	LayerFolderPath         string   // Where the layer folders are located
73 73
 	Layers                  []layer  // List of storage layers
74 74
 	ProcessorWeight         int64    // CPU Shares 1..9 on Windows; or 0 is platform default.
75
+	HostName                string   // Hostname
75 76
 }
76 77
 
77 78
 // defaultOwner is a tag passed to HCS to allow it to differentiate between
... ...
@@ -102,6 +103,7 @@ func (d *Driver) Run(ctx context.Context, c *execdriver.Command, pipes *execdriv
102 102
 		IgnoreFlushesDuringBoot: c.FirstStart,
103 103
 		LayerFolderPath:         c.LayerFolder,
104 104
 		ProcessorWeight:         c.Resources.CPUShares,
105
+		HostName:                c.Hostname,
105 106
 	}
106 107
 
107 108
 	for i := 0; i < len(c.LayerPaths); i++ {