2013-12-08 02:35:24 -05:00
|
|
|
package docker
|
|
|
|
|
|
|
|
import (
|
2014-02-11 19:05:45 -05:00
|
|
|
"github.com/dotcloud/docker/dockerversion"
|
2013-12-08 02:35:24 -05:00
|
|
|
"github.com/dotcloud/docker/engine"
|
|
|
|
"github.com/dotcloud/docker/utils"
|
|
|
|
"runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
engine.Register("version", jobVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
func jobVersion(job *engine.Job) engine.Status {
|
|
|
|
if _, err := dockerVersion().WriteTo(job.Stdout); err != nil {
|
|
|
|
job.Errorf("%s", err)
|
|
|
|
return engine.StatusErr
|
|
|
|
}
|
|
|
|
return engine.StatusOK
|
|
|
|
}
|
|
|
|
|
|
|
|
// dockerVersion returns detailed version information in the form of a queriable
|
|
|
|
// environment.
|
|
|
|
func dockerVersion() *engine.Env {
|
|
|
|
v := &engine.Env{}
|
2014-02-11 19:26:54 -05:00
|
|
|
v.Set("Version", dockerversion.VERSION)
|
|
|
|
v.Set("GitCommit", dockerversion.GITCOMMIT)
|
2013-12-08 02:35:24 -05:00
|
|
|
v.Set("GoVersion", runtime.Version())
|
2013-12-20 11:11:35 -05:00
|
|
|
v.Set("Os", runtime.GOOS)
|
|
|
|
v.Set("Arch", runtime.GOARCH)
|
2013-12-08 02:35:24 -05:00
|
|
|
// FIXME:utils.GetKernelVersion should only be needed here
|
|
|
|
if kernelVersion, err := utils.GetKernelVersion(); err == nil {
|
|
|
|
v.Set("KernelVersion", kernelVersion.String())
|
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|