Merge pull request #30788 from ripcurld0/hide_win_opts

Hide command options that are related to Windows
This commit is contained in:
Vincent Demeester 2017-03-13 16:15:29 +01:00 committed by GitHub
commit 278e4ccdc5
2 changed files with 12 additions and 0 deletions

View File

@ -51,6 +51,7 @@ type DockerCli struct {
keyFile string keyFile string
client client.APIClient client client.APIClient
hasExperimental bool hasExperimental bool
osType string
defaultVersion string defaultVersion string
} }
@ -59,6 +60,11 @@ func (cli *DockerCli) HasExperimental() bool {
return cli.hasExperimental return cli.hasExperimental
} }
// OSType returns the operating system the daemon is running on.
func (cli *DockerCli) OSType() string {
return cli.osType
}
// DefaultVersion returns api.defaultVersion of DOCKER_API_VERSION if specified. // DefaultVersion returns api.defaultVersion of DOCKER_API_VERSION if specified.
func (cli *DockerCli) DefaultVersion() string { func (cli *DockerCli) DefaultVersion() string {
return cli.defaultVersion return cli.defaultVersion
@ -166,6 +172,7 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions) error {
if ping, err := cli.client.Ping(context.Background()); err == nil { if ping, err := cli.client.Ping(context.Background()); err == nil {
cli.hasExperimental = ping.Experimental cli.hasExperimental = ping.Experimental
cli.osType = ping.OSType
// since the new header was added in 1.25, assume server is 1.24 if header is not present. // since the new header was added in 1.25, assume server is 1.24 if header is not present.
if ping.APIVersion == "" { if ping.APIVersion == "" {

View File

@ -189,6 +189,7 @@ func addFlags(flags *pflag.FlagSet) *containerOptions {
flags.Var(&copts.securityOpt, "security-opt", "Security Options") flags.Var(&copts.securityOpt, "security-opt", "Security Options")
flags.StringVar(&copts.usernsMode, "userns", "", "User namespace to use") flags.StringVar(&copts.usernsMode, "userns", "", "User namespace to use")
flags.StringVar(&copts.credentialSpec, "credentialspec", "", "Credential spec for managed service account (Windows only)") flags.StringVar(&copts.credentialSpec, "credentialspec", "", "Credential spec for managed service account (Windows only)")
flags.SetAnnotation("credentialspec", "ostype", []string{"windows"})
// Network and port publishing flag // Network and port publishing flag
flags.Var(&copts.extraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)") flags.Var(&copts.extraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)")
@ -239,7 +240,9 @@ func addFlags(flags *pflag.FlagSet) *containerOptions {
flags.StringVar(&copts.cpusetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)") flags.StringVar(&copts.cpusetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)")
flags.StringVar(&copts.cpusetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)") flags.StringVar(&copts.cpusetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)")
flags.Int64Var(&copts.cpuCount, "cpu-count", 0, "CPU count (Windows only)") flags.Int64Var(&copts.cpuCount, "cpu-count", 0, "CPU count (Windows only)")
flags.SetAnnotation("cpu-count", "ostype", []string{"windows"})
flags.Int64Var(&copts.cpuPercent, "cpu-percent", 0, "CPU percent (Windows only)") flags.Int64Var(&copts.cpuPercent, "cpu-percent", 0, "CPU percent (Windows only)")
flags.SetAnnotation("cpu-percent", "ostype", []string{"windows"})
flags.Int64Var(&copts.cpuPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period") flags.Int64Var(&copts.cpuPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period")
flags.Int64Var(&copts.cpuQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota") flags.Int64Var(&copts.cpuQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota")
flags.Int64Var(&copts.cpuRealtimePeriod, "cpu-rt-period", 0, "Limit CPU real-time period in microseconds") flags.Int64Var(&copts.cpuRealtimePeriod, "cpu-rt-period", 0, "Limit CPU real-time period in microseconds")
@ -254,7 +257,9 @@ func addFlags(flags *pflag.FlagSet) *containerOptions {
flags.Var(&copts.deviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) to a device") flags.Var(&copts.deviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) to a device")
flags.Var(&copts.deviceWriteIOps, "device-write-iops", "Limit write rate (IO per second) to a device") flags.Var(&copts.deviceWriteIOps, "device-write-iops", "Limit write rate (IO per second) to a device")
flags.Var(&copts.ioMaxBandwidth, "io-maxbandwidth", "Maximum IO bandwidth limit for the system drive (Windows only)") flags.Var(&copts.ioMaxBandwidth, "io-maxbandwidth", "Maximum IO bandwidth limit for the system drive (Windows only)")
flags.SetAnnotation("io-maxbandwidth", "ostype", []string{"windows"})
flags.Uint64Var(&copts.ioMaxIOps, "io-maxiops", 0, "Maximum IOps limit for the system drive (Windows only)") flags.Uint64Var(&copts.ioMaxIOps, "io-maxiops", 0, "Maximum IOps limit for the system drive (Windows only)")
flags.SetAnnotation("io-maxiops", "ostype", []string{"windows"})
flags.Var(&copts.kernelMemory, "kernel-memory", "Kernel memory limit") flags.Var(&copts.kernelMemory, "kernel-memory", "Kernel memory limit")
flags.VarP(&copts.memory, "memory", "m", "Memory limit") flags.VarP(&copts.memory, "memory", "m", "Memory limit")
flags.Var(&copts.memoryReservation, "memory-reservation", "Memory soft limit") flags.Var(&copts.memoryReservation, "memory-reservation", "Memory soft limit")