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>
This commit is contained in:
Yong Tang 2016-12-28 14:44:07 -08:00 committed by Vincent Demeester
parent 5a9a1569b9
commit 629abab4c0
1 changed files with 7 additions and 1 deletions

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