mirror of
https://github.com/moby/moby.git
synced 2025-12-06 07:41:18 +03:00
move resources from Config to HostConfig
Cgroup resources are host dependent, they should be in hostConfig.
For backward compatibility, we just copy it to hostConfig, and leave it in
Config for now, so there is no regressions, but the right way to use this
throught json is to put it in HostConfig, like:
{
"Hostname": "",
...
"HostConfig": {
"CpuShares": 512,
"Memory": 314572800,
...
}
}
As we will add CpusetMems, CpusetCpus is definitely a better name, but some
users are already using Cpuset in their http APIs, we also make it compatible.
The main idea is keep using Cpuset in Config Struct, and make it has the same
value as CpusetCpus, but not always, some scenarios:
- Users use --cpuset in docker command, it can setup cpuset.cpus and can
get Cpuset field from docker inspect or other http API which will get
config info.
- Users use --cpuset-cpus in docker command, ditto.
- Users use Cpuset field in their http APIs, ditto.
- Users use CpusetCpus field in their http APIs, they won't get Cpuset field
in Config info, because by then, they should already know what happens
to Cpuset.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
@@ -113,10 +113,6 @@ Create a container
|
||||
"Hostname": "",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 512,
|
||||
"Cpuset": "0,1",
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": true,
|
||||
"AttachStderr": true,
|
||||
@@ -143,6 +139,10 @@ Create a container
|
||||
"Binds": ["/tmp:/tmp"],
|
||||
"Links": ["redis3:redis"],
|
||||
"LxcConf": {"lxc.utsname":"docker"},
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 512,
|
||||
"CpusetCpus": "0,1",
|
||||
"PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
|
||||
"PublishAllPorts": false,
|
||||
"Privileged": false,
|
||||
@@ -182,7 +182,8 @@ Json Parameters:
|
||||
always use this with `memory`, and make the value larger than `memory`.
|
||||
- **CpuShares** - An integer value containing the CPU Shares for container
|
||||
(ie. the relative weight vs othercontainers).
|
||||
**CpuSet** - String value containg the cgroups Cpuset to use.
|
||||
- **Cpuset** - The same as CpusetCpus, but deprecated, please don't use.
|
||||
- **CpusetCpus** - String value containg the cgroups CpusetCpus to use.
|
||||
- **AttachStdin** - Boolean value, attaches to stdin.
|
||||
- **AttachStdout** - Boolean value, attaches to stdout.
|
||||
- **AttachStderr** - Boolean value, attaches to stderr.
|
||||
@@ -195,7 +196,7 @@ Json Parameters:
|
||||
of strings
|
||||
- **Image** - String value containing the image name to use for the container
|
||||
- **Volumes** – An object mapping mountpoint paths (strings) inside the
|
||||
container to empty objects.
|
||||
container to empty objects.
|
||||
- **WorkingDir** - A string value containing the working dir for commands to
|
||||
run in.
|
||||
- **NetworkDisabled** - Boolean value, when true disables neworking for the
|
||||
@@ -292,8 +293,6 @@ Return low-level information on the container `id`
|
||||
"-c",
|
||||
"exit 9"
|
||||
],
|
||||
"CpuShares": 0,
|
||||
"Cpuset": "",
|
||||
"Domainname": "",
|
||||
"Entrypoint": null,
|
||||
"Env": [
|
||||
@@ -303,8 +302,6 @@ Return low-level information on the container `id`
|
||||
"Hostname": "ba033ac44011",
|
||||
"Image": "ubuntu",
|
||||
"MacAddress": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"NetworkDisabled": false,
|
||||
"OnBuild": null,
|
||||
"OpenStdin": false,
|
||||
@@ -324,6 +321,8 @@ Return low-level information on the container `id`
|
||||
"CapAdd": null,
|
||||
"CapDrop": null,
|
||||
"ContainerIDFile": "",
|
||||
"CpusetCpus": "",
|
||||
"CpuShares": 0,
|
||||
"Devices": [],
|
||||
"Dns": null,
|
||||
"DnsSearch": null,
|
||||
@@ -331,6 +330,8 @@ Return low-level information on the container `id`
|
||||
"IpcMode": "",
|
||||
"Links": null,
|
||||
"LxcConf": [],
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"NetworkMode": "bridge",
|
||||
"PortBindings": {},
|
||||
"Privileged": false,
|
||||
@@ -1173,8 +1174,6 @@ Return low-level information on the image `name`
|
||||
{
|
||||
"Hostname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": false,
|
||||
"AttachStderr": false,
|
||||
@@ -1539,10 +1538,6 @@ Create a new image from a container's changes
|
||||
"Hostname": "",
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
"Memory": 0,
|
||||
"MemorySwap": 0,
|
||||
"CpuShares": 512,
|
||||
"Cpuset": "0,1",
|
||||
"AttachStdin": false,
|
||||
"AttachStdout": true,
|
||||
"AttachStderr": true,
|
||||
@@ -1896,10 +1891,6 @@ Return low-level information about the exec command `id`.
|
||||
"Hostname" : "8f177a186b97",
|
||||
"Domainname" : "",
|
||||
"User" : "",
|
||||
"Memory" : 0,
|
||||
"MemorySwap" : 0,
|
||||
"CpuShares" : 0,
|
||||
"Cpuset" : "",
|
||||
"AttachStdin" : false,
|
||||
"AttachStdout" : false,
|
||||
"AttachStderr" : false,
|
||||
|
||||
Reference in New Issue
Block a user