Browse code

Add isolation to info

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/09/08 07:10:00
Showing 8 changed files
... ...
@@ -260,6 +260,7 @@ type Info struct {
260 260
 	// running when the daemon is shutdown or upon daemon start if
261 261
 	// running containers are detected
262 262
 	LiveRestoreEnabled bool
263
+	Isolation          container.Isolation
263 264
 }
264 265
 
265 266
 // PluginsInfo is a temp struct holding Plugins name
... ...
@@ -141,6 +141,11 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error {
141 141
 		fmt.Fprintf(dockerCli.Out(), "\n")
142 142
 	}
143 143
 
144
+	// Isolation only has meaning on a Windows daemon.
145
+	if info.OSType == "windows" {
146
+		fmt.Fprintf(dockerCli.Out(), "Default Isolation: %v\n", info.Isolation)
147
+	}
148
+
144 149
 	ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Kernel Version: %s\n", info.KernelVersion)
145 150
 	ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Operating System: %s\n", info.OperatingSystem)
146 151
 	ioutils.FprintfIfNotEmpty(dockerCli.Out(), "OSType: %s\n", info.OSType)
... ...
@@ -118,6 +118,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
118 118
 		NoProxy:            sockets.GetProxyEnv("no_proxy"),
119 119
 		SecurityOptions:    securityOptions,
120 120
 		LiveRestoreEnabled: daemon.configStore.LiveRestoreEnabled,
121
+		Isolation:          daemon.defaultIsolation,
121 122
 	}
122 123
 
123 124
 	// TODO Windows. Refactor this more once sysinfo is refactored into
... ...
@@ -116,6 +116,7 @@ This section lists each version from latest to oldest.  Each listing includes a
116 116
 
117 117
 [Docker Remote API v1.25](docker_remote_api_v1.25.md) documentation
118 118
 
119
+* `GET /info` now returns `Isolation`.
119 120
 * `POST /containers/create` now takes `AutoRemove` in HostConfig, to enable auto-removal of the container on daemon side when the container's process exits.
120 121
 * `GET /containers/json` and `GET /containers/(id or name)/json` now return `"removing"` as a value for the `State.Status` field if the container is being removed. Previously, "exited" was returned as status.
121 122
 * `GET /containers/json` now accepts `removing` as a valid value for the `status` filter.
... ...
@@ -2221,7 +2221,7 @@ Display system-wide information
2221 2221
 
2222 2222
     GET /info HTTP/1.1
2223 2223
 
2224
-**Example response**:
2224
+**Example response (Linux)**:
2225 2225
 
2226 2226
     HTTP/1.1 200 OK
2227 2227
     Content-Type: application/json
... ...
@@ -2299,6 +2299,109 @@ Display system-wide information
2299 2299
         "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
2300 2300
     }
2301 2301
 
2302
+
2303
+**Example response (Windows)**:
2304
+
2305
+    HTTP/1.1 200 OK
2306
+    Content-Type: application/json
2307
+
2308
+    {
2309
+        "ID": "NYMS:B5VK:UMSL:FVDZ:EWB5:FKVK:LPFL:FJMQ:H6FT:BZJ6:L2TD:XH62",
2310
+        "Containers": 1,
2311
+        "ContainersRunning": 0,
2312
+        "ContainersPaused": 0,
2313
+        "ContainersStopped": 1,
2314
+        "Images": 17,
2315
+        "Driver": "windowsfilter",
2316
+        "DriverStatus": [
2317
+            ["Windows", ""]
2318
+        ],
2319
+        "SystemStatus": null,
2320
+            "Plugins": {
2321
+                "Volume": ["local"],
2322
+                "Network": ["nat", "null", "overlay"],
2323
+                "Authorization": null
2324
+            },
2325
+        "MemoryLimit": false,
2326
+        "SwapLimit": false,
2327
+        "KernelMemory": false,
2328
+        "CpuCfsPeriod": false,
2329
+        "CpuCfsQuota": false,
2330
+        "CPUShares": false,
2331
+        "CPUSet": false,
2332
+        "IPv4Forwarding": true,
2333
+        "BridgeNfIptables": true,
2334
+        "BridgeNfIp6tables": true,
2335
+        "Debug": false,
2336
+        "NFd": -1,
2337
+        "OomKillDisable": false,
2338
+        "NGoroutines": 11,
2339
+        "SystemTime": "2016-09-23T11:59:58.9843533-07:00",
2340
+        "LoggingDriver": "json-file",
2341
+        "CgroupDriver": "",
2342
+        "NEventsListener": 0,
2343
+        "KernelVersion": "10.0 14393 (14393.206.amd64fre.rs1_release.160912-1937)",
2344
+        "OperatingSystem": "Windows Server 2016 Datacenter",
2345
+        "OSType": "windows",
2346
+        "Architecture": "x86_64",
2347
+        "IndexServerAddress": "https://index.docker.io/v1/",
2348
+        "RegistryConfig": {
2349
+                "InsecureRegistryCIDRs": ["127.0.0.0/8"],
2350
+                "IndexConfigs": {
2351
+                    "docker.io": {
2352
+                        "Name": "docker.io",
2353
+                        "Mirrors": null,
2354
+                        "Secure": true,
2355
+                        "Official": true
2356
+                    }
2357
+                },
2358
+                "Mirrors": null
2359
+        },
2360
+        "NCPU": 8,
2361
+        "MemTotal": 4293828608,
2362
+        "DockerRootDir": "C:\\control",
2363
+        "HttpProxy": "",
2364
+        "HttpsProxy": "",
2365
+        "NoProxy": "",
2366
+        "Name": "WIN-V0V70C0LU5P",
2367
+        "Labels": null,
2368
+        "ExperimentalBuild": false,
2369
+        "ServerVersion": "1.13.0-dev",
2370
+        "ClusterStore": "",
2371
+        "ClusterAdvertise": "",
2372
+        "SecurityOptions": null,
2373
+        "Runtimes": null,
2374
+        "DefaultRuntime": "",
2375
+        "Swarm": {
2376
+            "NodeID": "",
2377
+            "NodeAddr": "",
2378
+            "LocalNodeState": "inactive",
2379
+            "ControlAvailable": false,
2380
+            "Error": "",
2381
+            "RemoteManagers": null,
2382
+            "Nodes": 0,
2383
+            "Managers": 0,
2384
+            "Cluster": {
2385
+                "ID": "",
2386
+                "Version": {},
2387
+                "CreatedAt": "0001-01-01T00:00:00Z",
2388
+                "UpdatedAt": "0001-01-01T00:00:00Z",
2389
+                "Spec": {
2390
+                    "Orchestration": {},
2391
+                    "Raft": {
2392
+                        "ElectionTick": 0,
2393
+                        "HeartbeatTick": 0
2394
+                    },
2395
+                    "Dispatcher": {},
2396
+                    "CAConfig": {},
2397
+                    "TaskDefaults": {}
2398
+                }
2399
+            }
2400
+        },
2401
+        "LiveRestoreEnabled": false,
2402
+        "Isolation": "process"
2403
+    }
2404
+
2302 2405
 **Status codes**:
2303 2406
 
2304 2407
 -   **200** – no error
... ...
@@ -154,3 +154,36 @@ You can also specify the output format:
154 154
 
155 155
     $ docker info --format '{{json .}}'
156 156
 	{"ID":"I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S","Containers":14, ...}
157
+
158
+Here is a sample output for a daemon running on Windows Server 2016:
159
+
160
+    E:\docker>docker info
161
+    Containers: 1
162
+     Running: 0
163
+     Paused: 0
164
+     Stopped: 1
165
+    Images: 17
166
+    Server Version: 1.13.0-dev
167
+    Storage Driver: windowsfilter
168
+     Windows:
169
+    Logging Driver: json-file
170
+    Plugins:
171
+     Volume: local
172
+     Network: nat null overlay
173
+    Swarm: inactive
174
+    Default Isolation: process
175
+    Kernel Version: 10.0 14393 (14393.206.amd64fre.rs1_release.160912-1937)
176
+    Operating System: Windows Server 2016 Datacenter
177
+    OSType: windows
178
+    Architecture: x86_64
179
+    CPUs: 8
180
+    Total Memory: 3.999 GiB
181
+    Name: WIN-V0V70C0LU5P
182
+    ID: NYMS:B5VK:UMSL:FVDZ:EWB5:FKVK:LPFL:FJMQ:H6FT:BZJ6:L2TD:XH62
183
+    Docker Root Dir: C:\control
184
+    Debug Mode (client): false
185
+    Debug Mode (server): false
186
+    Registry: https://index.docker.io/v1/
187
+    Insecure Registries:
188
+     127.0.0.0/8
189
+    Live Restore Enabled: false
157 190
\ No newline at end of file
... ...
@@ -9,6 +9,7 @@ import (
9 9
 	"path/filepath"
10 10
 	"strconv"
11 11
 
12
+	"github.com/docker/docker/api/types/container"
12 13
 	"github.com/docker/docker/pkg/reexec"
13 14
 )
14 15
 
... ...
@@ -69,6 +70,9 @@ var (
69 69
 	// Environment variable WINDOWS_BASE_IMAGE can override this
70 70
 	WindowsBaseImage = "windowsservercore"
71 71
 
72
+	// isolation is the isolation mode of the daemon under test
73
+	isolation container.Isolation
74
+
72 75
 	// daemonPid is the pid of the main test daemon
73 76
 	daemonPid int
74 77
 )
... ...
@@ -84,6 +84,7 @@ func init() {
84 84
 		volumesConfigPath = strings.Replace(volumesConfigPath, `\`, `/`, -1)
85 85
 		containerStoragePath = strings.Replace(containerStoragePath, `\`, `/`, -1)
86 86
 	}
87
+	isolation = info.Isolation
87 88
 }
88 89
 
89 90
 func convertBasesize(basesizeBytes int64) (int64, error) {