mirror of https://github.com/docker/cli.git
Add daemon option --default-shm-size
This fix fixes issue raised in 29492 where it was not possible to specify a default `--default-shm-size` in daemon configuration for each `docker run``. The flag `--default-shm-size` which is reloadable, has been added to the daemon configuation. Related docs has been updated. This fix fixes 29492. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
0e9401f84b
commit
ab794c5579
|
@ -11,7 +11,6 @@ import (
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
units "github.com/docker/go-units"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,26 +18,6 @@ type int64Value interface {
|
||||||
Value() int64
|
Value() int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type memBytes int64
|
|
||||||
|
|
||||||
func (m *memBytes) String() string {
|
|
||||||
return units.BytesSize(float64(m.Value()))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *memBytes) Set(value string) error {
|
|
||||||
val, err := units.RAMInBytes(value)
|
|
||||||
*m = memBytes(val)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *memBytes) Type() string {
|
|
||||||
return "bytes"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *memBytes) Value() int64 {
|
|
||||||
return int64(*m)
|
|
||||||
}
|
|
||||||
|
|
||||||
// PositiveDurationOpt is an option type for time.Duration that uses a pointer.
|
// PositiveDurationOpt is an option type for time.Duration that uses a pointer.
|
||||||
// It bahave similarly to DurationOpt but only allows positive duration values.
|
// It bahave similarly to DurationOpt but only allows positive duration values.
|
||||||
type PositiveDurationOpt struct {
|
type PositiveDurationOpt struct {
|
||||||
|
@ -149,9 +128,9 @@ type updateOptions struct {
|
||||||
|
|
||||||
type resourceOptions struct {
|
type resourceOptions struct {
|
||||||
limitCPU opts.NanoCPUs
|
limitCPU opts.NanoCPUs
|
||||||
limitMemBytes memBytes
|
limitMemBytes opts.MemBytes
|
||||||
resCPU opts.NanoCPUs
|
resCPU opts.NanoCPUs
|
||||||
resMemBytes memBytes
|
resMemBytes opts.MemBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *resourceOptions) ToResourceRequirements() *swarm.ResourceRequirements {
|
func (r *resourceOptions) ToResourceRequirements() *swarm.ResourceRequirements {
|
||||||
|
|
|
@ -11,12 +11,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMemBytesString(t *testing.T) {
|
func TestMemBytesString(t *testing.T) {
|
||||||
var mem memBytes = 1048576
|
var mem opts.MemBytes = 1048576
|
||||||
assert.Equal(t, mem.String(), "1 MiB")
|
assert.Equal(t, mem.String(), "1 MiB")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMemBytesSetAndValue(t *testing.T) {
|
func TestMemBytesSetAndValue(t *testing.T) {
|
||||||
var mem memBytes
|
var mem opts.MemBytes
|
||||||
assert.NilError(t, mem.Set("5kb"))
|
assert.NilError(t, mem.Set("5kb"))
|
||||||
assert.Equal(t, mem.Value(), int64(5120))
|
assert.Equal(t, mem.Value(), int64(5120))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue