Update opts.MemBytes to disable default, and move docker run/create/build to use opts.MemBytes

This fix made several updates:
1. Update opts.MemBytes so that default value will not show up.
   The reason is that in case a default value is decided by daemon,
   instead of client, we actually want to not show default value.
2. Move `docker run/create/build` to use opts.MemBytes for `--shm-size`
   This is to bring consistency between daemon and docker run
3. docs updates.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 629abab4c0
Component: cli
This commit is contained in:
Yong Tang
2017-05-15 11:57:21 +02:00
committed by Vincent Demeester
parent 5375c51c00
commit b28053256b
+7 -1
View File
@@ -409,7 +409,13 @@ type MemBytes int64
// String returns the string format of the human readable memory bytes
func (m *MemBytes) String() string {
return units.BytesSize(float64(m.Value()))
// NOTE: In spf13/pflag/flag.go, "0" is considered as "zero value" while "0 B" is not.
// We return "0" in case value is 0 here so that the default value is hidden.
// (Sometimes "default 0 B" is actually misleading)
if m.Value() != 0 {
return units.BytesSize(float64(m.Value()))
}
return "0"
}
// Set sets the value of the MemBytes by passing a string