implement "-c" option to allocate a number of CPU shares to a container

This commit is contained in:
Jérôme Petazzoni
2013-05-07 11:16:30 -07:00
parent a2b5196061
commit efd9becb78
7 changed files with 19 additions and 2 deletions
+4
View File
@@ -56,6 +56,7 @@ type Config struct {
User string
Memory int64 // Memory limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1' to disable swap
CpuShares int64 // CPU shares (relative weight vs. other containers)
AttachStdin bool
AttachStdout bool
AttachStderr bool
@@ -91,6 +92,8 @@ func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Con
*flMemory = 0
}
flCpuShares := cmd.Int64("c", 1024, "CPU shares (relative weight)")
var flPorts ListOpts
cmd.Var(&flPorts, "p", "Expose a container's port to the host (use 'docker port' to see the actual mapping)")
@@ -137,6 +140,7 @@ func ParseRun(args []string, stdout io.Writer, capabilities *Capabilities) (*Con
Tty: *flTty,
OpenStdin: *flStdin,
Memory: *flMemory,
CpuShares: *flCpuShares,
AttachStdin: flAttach.Get("stdin"),
AttachStdout: flAttach.Get("stdout"),
AttachStderr: flAttach.Get("stderr"),