Skip to content

Commit b12d3a9

Browse files
author
John Howard
committed
Add support for Windows-based containers
Signed-off-by: John Howard <[email protected]>
1 parent f0ecb45 commit b12d3a9

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Table of Contents
2020
- [General Configuration](config.md)
2121
- [Linux-specific Configuration](config-linux.md)
2222
- [Solaris-specific Configuration](config-solaris.md)
23+
- [Windows-specific Configuration](config-windows.md)
2324
- [Glossary](glossary.md)
2425

2526
In the specifications in the above table of contents, the keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in [RFC 2119](http://tools.ietf.org/html/rfc2119) (Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997).
@@ -30,6 +31,7 @@ An implementation is compliant for a given CPU architecture if it satisfies all
3031
Protocols defined by this specification are:
3132
* Linux containers: [runtime.md](runtime.md), [config.md](config.md), [config-linux.md](config-linux.md), and [runtime-linux.md](runtime-linux.md).
3233
* Solaris containers: [runtime.md](runtime.md), [config.md](config.md), and [config-solaris.md](config-solaris.md).
34+
* Windows containers: [runtime.md](runtime.md), [config.md](config.md), and [config-windows.md](config-windows.md).
3335

3436
# Use Cases
3537

config-windows.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Windows-specific Container Configuration
2+
3+
This document describes the schema for the [Windows-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md).
4+
The Windows container specification uses APIs provided by the Windows Host Compute Service (HCS) to fulfill the spec.
5+
6+
You can configure a container's resource limits via the `resources` field of the Windows configuration.
7+
Do not specify `resources` unless required.
8+
9+
10+
#### Memory
11+
12+
`memory` is an optional configuration for the container's memory usage.
13+
14+
The following parameters can be specified:
15+
16+
* **`limit`** *(uint64, optional)* - sets limit of memory usage in bytes
17+
18+
* **`reservation`** *(uint64, optional)* - sets soft limit of memory usage in bytes
19+
20+
###### Example
21+
22+
```json
23+
"memory": {
24+
"limit": 2097152,
25+
"reservation": 524288
26+
}
27+
```
28+
29+
#### CPU
30+
31+
`cpu` is an optional configuration for the container's CPU usage.
32+
33+
The following parameters can be specified:
34+
35+
* **`count`** *(uint64, optional)* - specifies the number of CPUs available to the container.
36+
37+
* **`shares`** *(uint64, optional)* - specifies the relative weight to other containers with CPU shares. The range is from 1 to 10000.
38+
39+
* **`percent`** *(uint, optional)* - specifies the percentage of available CPUs usable by the container.
40+
41+
###### Example
42+
43+
```json
44+
"cpu": {
45+
"percent": 50
46+
}
47+
```
48+
49+
#### Storage
50+
51+
`storage` is an optional configuration for the container's storage usage.
52+
53+
The following parameters can be specified:
54+
55+
* **`iops`** *(uint64, optional)* - specifies the maximum Iops for the system drive of the container.
56+
57+
* **`bps`** *(uint64, optional)* - specifies the maximum bytes per second for the system drive of the container.
58+
59+
* **`sandboxSize`** *(uint64, optional)* - specifies the size to expand the system drive of the container to if it is currently smaller.
60+
61+
###### Example
62+
63+
```json
64+
"storage": {
65+
"iops": 50
66+
}
67+
```
68+
69+
#### Network
70+
71+
`network` is an optional configuration for the container's network usage.
72+
73+
The following parameters can be specified:
74+
75+
* **`egressBandwidth`** *(uint64, optional)* - specified the maximum egress bandwidth in bytes per second for the container.
76+
77+
###### Example
78+
79+
```json
80+
"network": {
81+
"egressBandwidth": 1048577
82+
}
83+
```

config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ For Windows based systems the user structure has the following fields:
256256
This SHOULD only be set if **`platform.os`** is `linux`.
257257
* **`solaris`** (object, optional) [Solaris-specific configuration](config-solaris.md).
258258
This SHOULD only be set if **`platform.os`** is `solaris`.
259+
* **`windows`** (object, optional) [Windows-specific configuration](config-windows.md).
260+
This SHOULD only be set if **`platform.os`** is `windows`.
259261

260262
### Example (Linux)
261263

specs-go/config.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type Spec struct {
2525
Linux *Linux `json:"linux,omitempty" platform:"linux"`
2626
// Solaris is platform specific configuration for Solaris containers.
2727
Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"`
28+
// Windows is platform specific configuration for Windows based containers, including Hyper-V containers.
29+
Windows *Windows `json:"windows,omitempty" platform:"windows"`
2830
}
2931

3032
// Process contains information to start a specific application inside the container.
@@ -406,6 +408,58 @@ type Anet struct {
406408
Macaddress string `json:"macAddress,omitempty"`
407409
}
408410

411+
// Windows defines the runtime configuration for Windows based containers, including Hyper-V containers.
412+
type Windows struct {
413+
// Resources contains information for handling resource constraints for the container.
414+
Resources *WindowsResources `json:"resources,omitempty"`
415+
}
416+
417+
// WindowsResources has container runtime resource constraints for containers running on Windows.
418+
type WindowsResources struct {
419+
// Memory restriction configuration.
420+
Memory *WindowsMemoryResources `json:"memory,omitempty"`
421+
// CPU resource restriction configuration.
422+
CPU *WindowsCPUResources `json:"cpu,omitempty"`
423+
// Storage restriction configuration.
424+
Storage *WindowsStorageResources `json:"storage,omitempty"`
425+
// Network restriction configuration.
426+
Network *WindowsNetworkResources `json:"network,omitempty"`
427+
}
428+
429+
// WindowsMemoryResources contains memory resource management settings.
430+
type WindowsMemoryResources struct {
431+
// Memory limit in bytes.
432+
Limit *uint64 `json:"limit,omitempty"`
433+
// Memory reservation in bytes.
434+
Reservation *uint64 `json:"reservation,omitempty"`
435+
}
436+
437+
// WindowsCPUResources contains CPU resource management settings.
438+
type WindowsCPUResources struct {
439+
// Number of CPUs available to the container.
440+
Count *uint64 `json:"count,omitempty"`
441+
// CPU shares (relative weight to other containers with cpu shares). Range is from 1 to 10000.
442+
Shares *uint64 `json:"shares,omitempty"`
443+
// Percent of available CPUs usable by the container.
444+
Percent *uint `json:"percent,omitempty"`
445+
}
446+
447+
// WindowsStorageResources contains storage resource management settings.
448+
type WindowsStorageResources struct {
449+
// Specifies maximum Iops for the system drive.
450+
Iops *uint64 `json:"iops,omitempty"`
451+
// Specifies maximum bytes per second for the system drive.
452+
Bps *uint64 `json:"bps,omitempty"`
453+
// Sandbox size specifies the minimum size of the system drive in bytes.
454+
SandboxSize *uint64 `json:"sandboxSize,omitempty"`
455+
}
456+
457+
// WindowsNetworkResources contains network resource management settings.
458+
type WindowsNetworkResources struct {
459+
// EgressBandwidth is the maximum egress bandwidth in bytes per second.
460+
EgressBandwidth *uint64 `json:"egressBandwidth,omitempty"`
461+
}
462+
409463
// Arch used for additional architectures
410464
type Arch string
411465

0 commit comments

Comments
 (0)