Skip to content

Commit 778aba4

Browse files
committed
Remove Memory MemorySwap CpuShares from config
As I said in opencontainers/image-spec#371 (comment), I'd like to remove these resource limit from image-spec. On the on hand, if we have this, we should have limit the min and max size of these value. For example, in docker, there are some min and max limit for some resource, see https://github.com/docker/docker/blob/master/daemon/daemon_unix.go#L48 Signed-off-by: Lei Jitang <[email protected]>
1 parent ad64f2e commit 778aba4

File tree

5 files changed

+13
-52
lines changed

5 files changed

+13
-52
lines changed

config.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Using a layer-based or union filesystem such as AUFS, or by computing the diff f
1818

1919
### Image JSON
2020

21-
Each image has an associated JSON structure which describes some basic information about the image such as date created, author, as well as execution/runtime configuration like its entrypoint, default arguments, CPU/memory shares, networking, and volumes.
21+
Each image has an associated JSON structure which describes some basic information about the image such as date created, author, as well as execution/runtime configuration like its entrypoint, default arguments, networking, and volumes.
2222
The JSON structure also references a cryptographic hash of each layer used by the image, and provides history information for those layers.
2323
This JSON is considered to be immutable, because changing it would change the computed [ImageID](#imageid).
2424
Changing it means creating a new derived image, instead of changing the existing image.
@@ -79,21 +79,6 @@ Note: Any OPTIONAL field MAY also be set to null, which is equivalent to being a
7979
For Linux based systems, all of the following are valid: `user`, `uid`, `user:group`, `uid:gid`, `uid:group`, `user:gid`.
8080
If `group`/`gid` is not specified, the default group and supplementary groups of the given `user`/`uid` in `/etc/passwd` from the container are applied.
8181

82-
- **Memory** *integer*, OPTIONAL
83-
84-
Memory limit (in bytes).
85-
This acts as a default value to use when the value is not specified when creating a container.
86-
87-
- **MemorySwap** *integer*, OPTIONAL
88-
89-
MemorySwap is a platform-specific field to set total memory usage (memory + swap) for Linux based systems; set to `-1` to disable swap.
90-
This acts as a default value to use when the value is not specified when creating a container.
91-
92-
- **CpuShares** *integer*, OPTIONAL
93-
94-
CPU shares (relative weight vs. other containers).
95-
This acts as a default value to use when the value is not specified when creating a container.
96-
9782
- **ExposedPorts** *object*, OPTIONAL
9883

9984
A set of ports to expose from a container running this image.
@@ -196,9 +181,6 @@ Here is an example image configuration JSON document:
196181
"os": "linux",
197182
"config": {
198183
"User": "alice",
199-
"Memory": 2048,
200-
"MemorySwap": 4096,
201-
"CpuShares": 8,
202184
"ExposedPorts": {
203185
"8080/tcp": {}
204186
},

schema/config_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ func TestConfig(t *testing.T) {
144144
"os": "linux",
145145
"config": {
146146
"User": "1:1",
147-
"Memory": 2048,
148-
"MemorySwap": 4096,
149-
"CpuShares": 8,
150147
"ExposedPorts": {
151148
"8080/tcp": {}
152149
},

schema/defs-config.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77
"User": {
88
"type": "string"
99
},
10-
"Memory": {
11-
"$ref": "defs.json#/definitions/int64"
12-
},
13-
"MemorySwap": {
14-
"$ref": "defs.json#/definitions/int64"
15-
},
16-
"CpuShares": {
17-
"$ref": "defs.json#/definitions/int64"
18-
},
1910
"ExposedPorts": {
2011
"$ref": "defs.json#/definitions/mapStringObject"
2112
},

schema/fs.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -233,24 +233,24 @@ DLQ9RAMAAA==
233233

234234
"/defs-config.json": {
235235
local: "defs-config.json",
236-
size: 2483,
237-
modtime: 1480556605,
236+
size: 2236,
237+
modtime: 1481704571,
238238
compressed: `
239-
H4sIAAAJbogA/+RWzY7TMBC+5ykiw7GwF8SB6y43UJEi4IBQ5SaT7Syxx4wnQIT23XGypRsnrel2tycO
240-
VRvH389845/+zvJcVeBLRidIVr3J1RXUaLF/8rnTLFi2jeZcKF86sJdkRaMFzsOvGq/zwkGJNZZ6wC/u
241-
CHcMgbDXCIPlMH33HEakc9AL0voGShmgw7hjchB0wY9mh/GPHjgaGXF4YbTXavfqdnGPew+GuJsinzPU
242-
PTKY9S9vPNlnFyPfF2jl9asUX/FTu6fjvHRtsdE8KflRlG9/OfJQfSCWh7Ia7Yoh0OVda/bz2x+HuqGZ
243-
dacW41coYKY2Ev0LUgdEhTtHoeypNllY9jV9iQRiuaTFhM1/WI3tTiwnXdi2aWKmMc/X/UvFVP9t7Z+o
244-
ac18kxxZ/6mr/txVfSb+FmSv8KTj7Z1eQ3PuSIo9jX/ySLLx95ZdMZHU/jH3RoV1vcJqFtH5T6vt/FRL
245-
I1mwrZn1TDW6A/YqndkuBYbvLTJUEc99BlN32Zjxb+Yb9BJfmQ8OvWTQArOTKlV9TWy0DKsxQF8IGti/
246-
4nUrGzppr2xdrdazvwNHockYmN88x0DBOOlWQycPwddEDWirDu2HrP/cZn8CAAD//0zDaxqzCQAA
239+
H4sIAAAJbogA/+RVzY7TMBC+5yksw7Gwd6673JCKVAEHhCo3Ge/OEnvMeIKI0L47TrZ0888qpac9VG0m
240+
/n7m89j9nSmlC4g5YxAkr98pfQMWPTZPUQXDgnlVGlZCahvAX5MXgx5YpV8Wb9UuQI4Wc9PiN4+EJ4ZE
241+
2GikYt4uPz2nitQBGkE63EMuLbStB6YASRdiZ3Wqf4rAvUqHIwqjv9WnVw+bJ9z7X4EiFB+JJQ7xrxls
242+
g0+W49v7SP7VVcf9lTNh1zJvHz1O8/ufc7YMs6n1pvsKBdzQxkIjSWpGVLgOhF6G2uRh2/T0tSfQl1u0
243+
uGDzH1b7dgeWF134qiz7TF2eb5MRXLvixfb+mcrKwWicn9n/2qm/dFdfiL8n2Rtcdc4/mAOUl45kN7Hx
244+
/z2SrPt9ZNdMJDaec4EWaO0ei1FEl7+tjuuXtrQnC75yoz3TpamBo17O7JQCw48KGYoez1MGQ3dZl/Fv
245+
5ncYhbg+J/ScwQiMbqql7i2xM9JOY4K+EXQwPfGmkjtadVaOrvaHehWanIPxP89zoOCC1Pt2J+fgB6IS
246+
jNdz5yFrPg/ZnwAAAP//3oH4m7wIAAA=
247247
`,
248248
},
249249

250250
"/defs-image.json": {
251251
local: "defs-image.json",
252252
size: 2736,
253-
modtime: 1480556516,
253+
modtime: 1481704392,
254254
compressed: `
255255
H4sIAAAJbogA/7yWy27bOhCG934KQgmQhS86i4MCNYIARbPpKot01cAtJtTImlQiVZJO6gR+95K6UrcE
256256
boyuEg7Jn/83nBH9MmMsiFBzRbkhKYI1C64xJkFupFkOyhDfpaCYkewmR/FZCgMkULEvGWyR3ebIKSYO
@@ -289,7 +289,7 @@ MrVJbn8cB+ZnN/gbAAD//0JyEpx5DAAA
289289
"/image-manifest-schema.json": {
290290
local: "image-manifest-schema.json",
291291
size: 1139,
292-
modtime: 1480556516,
292+
modtime: 1481704392,
293293
compressed: `
294294
H4sIAAAJbogA/6RSO4/UMBDu8ytGvuu4xByiupbqCkTBiQZRmHiSzCl+YPtWrFb73/Ej3mx2KRBb5ou/
295295
18wcGgAm0feObCCj2ROwLxb1J6ODII0OnpUYET4LTQP6AF8t9jRQL/Lrh0S/9/2ESiTqFIJ94vzVG90W

specs-go/v1/config.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ type ImageConfig struct {
1919
// User defines the username or UID which the process in the container should run as.
2020
User string `json:"User,omitempty"`
2121

22-
// Memory defines the memory limit.
23-
Memory int64 `json:"Memory,omitempty"`
24-
25-
// MemorySwap defines the total memory usage limit (memory + swap).
26-
MemorySwap int64 `json:"MemorySwap,omitempty"`
27-
28-
// CPUShares is the CPU shares (relative weight vs. other containers).
29-
CPUShares int64 `json:"CpuShares,omitempty"`
30-
3122
// ExposedPorts a set of ports to expose from a container running this image.
3223
ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"`
3324

0 commit comments

Comments
 (0)