mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
docker -v: show version and build information without making remote connections
This commit is contained in:
parent
9087ef9a77
commit
9fce6f662a
1 changed files with 9 additions and 0 deletions
|
@ -26,6 +26,7 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// FIXME: Switch d and D ? (to be more sshd like)
|
// FIXME: Switch d and D ? (to be more sshd like)
|
||||||
|
flVersion := flag.Bool("v", false, "Print version information and quit")
|
||||||
flDaemon := flag.Bool("d", false, "Daemon mode")
|
flDaemon := flag.Bool("d", false, "Daemon mode")
|
||||||
flDebug := flag.Bool("D", false, "Debug mode")
|
flDebug := flag.Bool("D", false, "Debug mode")
|
||||||
flAutoRestart := flag.Bool("r", false, "Restart previously running containers")
|
flAutoRestart := flag.Bool("r", false, "Restart previously running containers")
|
||||||
|
@ -37,6 +38,10 @@ func main() {
|
||||||
flHosts := docker.ListOpts{fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET)}
|
flHosts := docker.ListOpts{fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET)}
|
||||||
flag.Var(&flHosts, "H", "tcp://host:port to bind/connect to or unix://path/to/socket to use")
|
flag.Var(&flHosts, "H", "tcp://host:port to bind/connect to or unix://path/to/socket to use")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
if *flVersion {
|
||||||
|
showVersion()
|
||||||
|
return
|
||||||
|
}
|
||||||
if len(flHosts) > 1 {
|
if len(flHosts) > 1 {
|
||||||
flHosts = flHosts[1:] //trick to display a nice default value in the usage
|
flHosts = flHosts[1:] //trick to display a nice default value in the usage
|
||||||
}
|
}
|
||||||
|
@ -76,6 +81,10 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func showVersion() {
|
||||||
|
fmt.Printf("Docker version %s, build %s\n", VERSION, GITCOMMIT)
|
||||||
|
}
|
||||||
|
|
||||||
func createPidFile(pidfile string) error {
|
func createPidFile(pidfile string) error {
|
||||||
if pidString, err := ioutil.ReadFile(pidfile); err == nil {
|
if pidString, err := ioutil.ReadFile(pidfile); err == nil {
|
||||||
pid, err := strconv.Atoi(string(pidString))
|
pid, err := strconv.Atoi(string(pidString))
|
||||||
|
|
Loading…
Reference in a new issue