mirror of
https://github.com/docker/compose.git
synced 2026-08-04 14:47:40 +00:00
Integrate limits on inspect
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
parent
0a57fd7d5c
commit
1deb2b8b09
16 changed files with 363 additions and 154 deletions
2
cli/cmd/run/testdata/run-help.golden
vendored
2
cli/cmd/run/testdata/run-help.golden
vendored
|
|
@ -4,8 +4,10 @@ Usage:
|
|||
run [flags]
|
||||
|
||||
Flags:
|
||||
--cpus float Number of CPUs (default 1)
|
||||
-d, --detach Run container in background and print container ID (default true)
|
||||
-l, --label stringArray Set meta data on a container
|
||||
-m, --memory bytes Memory limit
|
||||
--name string Assign a name to the container
|
||||
-p, --publish stringArray Publish a container's port(s). [HOST_PORT:]CONTAINER_PORT
|
||||
-v, --volume stringArray Volume. Ex: user:key@my_share:/absolute/path/to/target
|
||||
|
|
|
|||
1
cli/cmd/testdata/inspect-out-id.golden
vendored
1
cli/cmd/testdata/inspect-out-id.golden
vendored
|
|
@ -4,6 +4,7 @@
|
|||
"Image": "nginx",
|
||||
"Command": "",
|
||||
"CPUTime": 0,
|
||||
"CPULimit": 0,
|
||||
"MemoryUsage": 0,
|
||||
"MemoryLimit": 0,
|
||||
"PidsCurrent": 0,
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/docker/pkg/namesgenerator"
|
||||
"github.com/docker/go-connections/nat"
|
||||
|
||||
"github.com/docker/api/containers"
|
||||
"github.com/docker/api/formatter"
|
||||
)
|
||||
|
||||
// Opts contain run command options
|
||||
|
|
@ -35,7 +35,7 @@ type Opts struct {
|
|||
Labels []string
|
||||
Volumes []string
|
||||
Cpus float64
|
||||
Memory opts.MemBytes
|
||||
Memory formatter.MemBytes
|
||||
}
|
||||
|
||||
// ToContainerConfig convert run options to a container configuration
|
||||
|
|
@ -61,7 +61,7 @@ func (r *Opts) ToContainerConfig(image string) (containers.ContainerConfig, erro
|
|||
Labels: labels,
|
||||
Volumes: r.Volumes,
|
||||
MemLimit: r.Memory,
|
||||
CpuLimit: r.Cpus,
|
||||
CPULimit: r.Cpus,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue