Merge pull request #1638 from ijc/separate-client-system-info

Separate client infomation in `docker system info`
This commit is contained in:
Sebastiaan van Stijn 2019-01-25 17:32:07 +01:00 committed by GitHub
commit 080f30a60f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 760 additions and 524 deletions

View File

@ -21,6 +21,23 @@ type infoOptions struct {
format string format string
} }
type clientInfo struct {
Debug bool
Warnings []string
}
type info struct {
// This field should/could be ServerInfo but is anonymous to
// preserve backwards compatibility in the JSON rendering
// which has ServerInfo immediately within the top-level
// object.
*types.Info `json:",omitempty"`
ServerErrors []string `json:",omitempty"`
ClientInfo *clientInfo `json:",omitempty"`
ClientErrors []string `json:",omitempty"`
}
// NewInfoCommand creates a new cobra.Command for `docker info` // NewInfoCommand creates a new cobra.Command for `docker info`
func NewInfoCommand(dockerCli command.Cli) *cobra.Command { func NewInfoCommand(dockerCli command.Cli) *cobra.Command {
var opts infoOptions var opts infoOptions
@ -42,26 +59,74 @@ func NewInfoCommand(dockerCli command.Cli) *cobra.Command {
} }
func runInfo(dockerCli command.Cli, opts *infoOptions) error { func runInfo(dockerCli command.Cli, opts *infoOptions) error {
var info info
ctx := context.Background() ctx := context.Background()
info, err := dockerCli.Client().Info(ctx) if dinfo, err := dockerCli.Client().Info(ctx); err == nil {
if err != nil { info.Info = &dinfo
return err } else {
info.ServerErrors = append(info.ServerErrors, err.Error())
} }
info.ClientInfo = &clientInfo{
Debug: debug.IsEnabled(),
}
if opts.format == "" { if opts.format == "" {
return prettyPrintInfo(dockerCli, info) return prettyPrintInfo(dockerCli, info)
} }
return formatInfo(dockerCli, info, opts.format) return formatInfo(dockerCli, info, opts.format)
} }
func prettyPrintInfo(dockerCli command.Cli, info info) error {
fmt.Fprintln(dockerCli.Out(), "Client:")
if info.ClientInfo != nil {
if err := prettyPrintClientInfo(dockerCli, *info.ClientInfo); err != nil {
info.ClientErrors = append(info.ClientErrors, err.Error())
}
}
for _, err := range info.ClientErrors {
fmt.Fprintln(dockerCli.Out(), "ERROR:", err)
}
fmt.Fprintln(dockerCli.Out())
fmt.Fprintln(dockerCli.Out(), "Server:")
if info.Info != nil {
for _, err := range prettyPrintServerInfo(dockerCli, *info.Info) {
info.ServerErrors = append(info.ServerErrors, err.Error())
}
}
for _, err := range info.ServerErrors {
fmt.Fprintln(dockerCli.Out(), "ERROR:", err)
}
if len(info.ServerErrors) > 0 || len(info.ClientErrors) > 0 {
return fmt.Errorf("errors pretty printing info")
}
return nil
}
func prettyPrintClientInfo(dockerCli command.Cli, info clientInfo) error {
fmt.Fprintln(dockerCli.Out(), " Debug Mode:", info.Debug)
if len(info.Warnings) > 0 {
fmt.Fprintln(dockerCli.Err(), strings.Join(info.Warnings, "\n"))
}
return nil
}
// nolint: gocyclo // nolint: gocyclo
func prettyPrintInfo(dockerCli command.Cli, info types.Info) error { func prettyPrintServerInfo(dockerCli command.Cli, info types.Info) []error {
fmt.Fprintln(dockerCli.Out(), "Containers:", info.Containers) var errs []error
fmt.Fprintln(dockerCli.Out(), " Containers:", info.Containers)
fmt.Fprintln(dockerCli.Out(), " Running:", info.ContainersRunning) fmt.Fprintln(dockerCli.Out(), " Running:", info.ContainersRunning)
fmt.Fprintln(dockerCli.Out(), " Paused:", info.ContainersPaused) fmt.Fprintln(dockerCli.Out(), " Paused:", info.ContainersPaused)
fmt.Fprintln(dockerCli.Out(), " Stopped:", info.ContainersStopped) fmt.Fprintln(dockerCli.Out(), " Stopped:", info.ContainersStopped)
fmt.Fprintln(dockerCli.Out(), "Images:", info.Images) fmt.Fprintln(dockerCli.Out(), " Images:", info.Images)
fprintlnNonEmpty(dockerCli.Out(), "Server Version:", info.ServerVersion) fprintlnNonEmpty(dockerCli.Out(), " Server Version:", info.ServerVersion)
fprintlnNonEmpty(dockerCli.Out(), "Storage Driver:", info.Driver) fprintlnNonEmpty(dockerCli.Out(), " Storage Driver:", info.Driver)
if info.DriverStatus != nil { if info.DriverStatus != nil {
for _, pair := range info.DriverStatus { for _, pair := range info.DriverStatus {
fmt.Fprintf(dockerCli.Out(), " %s: %s\n", pair[0], pair[1]) fmt.Fprintf(dockerCli.Out(), " %s: %s\n", pair[0], pair[1])
@ -69,13 +134,13 @@ func prettyPrintInfo(dockerCli command.Cli, info types.Info) error {
} }
if info.SystemStatus != nil { if info.SystemStatus != nil {
for _, pair := range info.SystemStatus { for _, pair := range info.SystemStatus {
fmt.Fprintf(dockerCli.Out(), "%s: %s\n", pair[0], pair[1]) fmt.Fprintf(dockerCli.Out(), " %s: %s\n", pair[0], pair[1])
} }
} }
fprintlnNonEmpty(dockerCli.Out(), "Logging Driver:", info.LoggingDriver) fprintlnNonEmpty(dockerCli.Out(), " Logging Driver:", info.LoggingDriver)
fprintlnNonEmpty(dockerCli.Out(), "Cgroup Driver:", info.CgroupDriver) fprintlnNonEmpty(dockerCli.Out(), " Cgroup Driver:", info.CgroupDriver)
fmt.Fprintln(dockerCli.Out(), "Plugins:") fmt.Fprintln(dockerCli.Out(), " Plugins:")
fmt.Fprintln(dockerCli.Out(), " Volume:", strings.Join(info.Plugins.Volume, " ")) fmt.Fprintln(dockerCli.Out(), " Volume:", strings.Join(info.Plugins.Volume, " "))
fmt.Fprintln(dockerCli.Out(), " Network:", strings.Join(info.Plugins.Network, " ")) fmt.Fprintln(dockerCli.Out(), " Network:", strings.Join(info.Plugins.Network, " "))
@ -85,20 +150,20 @@ func prettyPrintInfo(dockerCli command.Cli, info types.Info) error {
fmt.Fprintln(dockerCli.Out(), " Log:", strings.Join(info.Plugins.Log, " ")) fmt.Fprintln(dockerCli.Out(), " Log:", strings.Join(info.Plugins.Log, " "))
fmt.Fprintln(dockerCli.Out(), "Swarm:", info.Swarm.LocalNodeState) fmt.Fprintln(dockerCli.Out(), " Swarm:", info.Swarm.LocalNodeState)
printSwarmInfo(dockerCli, info) printSwarmInfo(dockerCli, info)
if len(info.Runtimes) > 0 { if len(info.Runtimes) > 0 {
fmt.Fprint(dockerCli.Out(), "Runtimes:") fmt.Fprint(dockerCli.Out(), " Runtimes:")
for name := range info.Runtimes { for name := range info.Runtimes {
fmt.Fprintf(dockerCli.Out(), " %s", name) fmt.Fprintf(dockerCli.Out(), " %s", name)
} }
fmt.Fprint(dockerCli.Out(), "\n") fmt.Fprint(dockerCli.Out(), "\n")
fmt.Fprintln(dockerCli.Out(), "Default Runtime:", info.DefaultRuntime) fmt.Fprintln(dockerCli.Out(), " Default Runtime:", info.DefaultRuntime)
} }
if info.OSType == "linux" { if info.OSType == "linux" {
fmt.Fprintln(dockerCli.Out(), "Init Binary:", info.InitBinary) fmt.Fprintln(dockerCli.Out(), " Init Binary:", info.InitBinary)
for _, ci := range []struct { for _, ci := range []struct {
Name string Name string
@ -108,18 +173,17 @@ func prettyPrintInfo(dockerCli command.Cli, info types.Info) error {
{"runc", info.RuncCommit}, {"runc", info.RuncCommit},
{"init", info.InitCommit}, {"init", info.InitCommit},
} { } {
fmt.Fprintf(dockerCli.Out(), "%s version: %s", ci.Name, ci.Commit.ID) fmt.Fprintf(dockerCli.Out(), " %s version: %s", ci.Name, ci.Commit.ID)
if ci.Commit.ID != ci.Commit.Expected { if ci.Commit.ID != ci.Commit.Expected {
fmt.Fprintf(dockerCli.Out(), " (expected: %s)", ci.Commit.Expected) fmt.Fprintf(dockerCli.Out(), " (expected: %s)", ci.Commit.Expected)
} }
fmt.Fprint(dockerCli.Out(), "\n") fmt.Fprint(dockerCli.Out(), "\n")
} }
if len(info.SecurityOptions) != 0 { if len(info.SecurityOptions) != 0 {
kvs, err := types.DecodeSecurityOptions(info.SecurityOptions) if kvs, err := types.DecodeSecurityOptions(info.SecurityOptions); err != nil {
if err != nil { errs = append(errs, err)
return err } else {
} fmt.Fprintln(dockerCli.Out(), " Security Options:")
fmt.Fprintln(dockerCli.Out(), "Security Options:")
for _, so := range kvs { for _, so := range kvs {
fmt.Fprintln(dockerCli.Out(), " "+so.Name) fmt.Fprintln(dockerCli.Out(), " "+so.Name)
for _, o := range so.Options { for _, o := range so.Options {
@ -134,23 +198,23 @@ func prettyPrintInfo(dockerCli command.Cli, info types.Info) error {
} }
} }
} }
}
// Isolation only has meaning on a Windows daemon. // Isolation only has meaning on a Windows daemon.
if info.OSType == "windows" { if info.OSType == "windows" {
fmt.Fprintln(dockerCli.Out(), "Default Isolation:", info.Isolation) fmt.Fprintln(dockerCli.Out(), " Default Isolation:", info.Isolation)
} }
fprintlnNonEmpty(dockerCli.Out(), "Kernel Version:", info.KernelVersion) fprintlnNonEmpty(dockerCli.Out(), " Kernel Version:", info.KernelVersion)
fprintlnNonEmpty(dockerCli.Out(), "Operating System:", info.OperatingSystem) fprintlnNonEmpty(dockerCli.Out(), " Operating System:", info.OperatingSystem)
fprintlnNonEmpty(dockerCli.Out(), "OSType:", info.OSType) fprintlnNonEmpty(dockerCli.Out(), " OSType:", info.OSType)
fprintlnNonEmpty(dockerCli.Out(), "Architecture:", info.Architecture) fprintlnNonEmpty(dockerCli.Out(), " Architecture:", info.Architecture)
fmt.Fprintln(dockerCli.Out(), "CPUs:", info.NCPU) fmt.Fprintln(dockerCli.Out(), " CPUs:", info.NCPU)
fmt.Fprintln(dockerCli.Out(), "Total Memory:", units.BytesSize(float64(info.MemTotal))) fmt.Fprintln(dockerCli.Out(), " Total Memory:", units.BytesSize(float64(info.MemTotal)))
fprintlnNonEmpty(dockerCli.Out(), "Name:", info.Name) fprintlnNonEmpty(dockerCli.Out(), " Name:", info.Name)
fprintlnNonEmpty(dockerCli.Out(), "ID:", info.ID) fprintlnNonEmpty(dockerCli.Out(), " ID:", info.ID)
fmt.Fprintln(dockerCli.Out(), "Docker Root Dir:", info.DockerRootDir) fmt.Fprintln(dockerCli.Out(), " Docker Root Dir:", info.DockerRootDir)
fmt.Fprintln(dockerCli.Out(), "Debug Mode (client):", debug.IsEnabled()) fmt.Fprintln(dockerCli.Out(), " Debug Mode:", info.Debug)
fmt.Fprintln(dockerCli.Out(), "Debug Mode (server):", info.Debug)
if info.Debug { if info.Debug {
fmt.Fprintln(dockerCli.Out(), " File Descriptors:", info.NFd) fmt.Fprintln(dockerCli.Out(), " File Descriptors:", info.NFd)
@ -159,31 +223,31 @@ func prettyPrintInfo(dockerCli command.Cli, info types.Info) error {
fmt.Fprintln(dockerCli.Out(), " EventsListeners:", info.NEventsListener) fmt.Fprintln(dockerCli.Out(), " EventsListeners:", info.NEventsListener)
} }
fprintlnNonEmpty(dockerCli.Out(), "HTTP Proxy:", info.HTTPProxy) fprintlnNonEmpty(dockerCli.Out(), " HTTP Proxy:", info.HTTPProxy)
fprintlnNonEmpty(dockerCli.Out(), "HTTPS Proxy:", info.HTTPSProxy) fprintlnNonEmpty(dockerCli.Out(), " HTTPS Proxy:", info.HTTPSProxy)
fprintlnNonEmpty(dockerCli.Out(), "No Proxy:", info.NoProxy) fprintlnNonEmpty(dockerCli.Out(), " No Proxy:", info.NoProxy)
if info.IndexServerAddress != "" { if info.IndexServerAddress != "" {
u := dockerCli.ConfigFile().AuthConfigs[info.IndexServerAddress].Username u := dockerCli.ConfigFile().AuthConfigs[info.IndexServerAddress].Username
if len(u) > 0 { if len(u) > 0 {
fmt.Fprintln(dockerCli.Out(), "Username:", u) fmt.Fprintln(dockerCli.Out(), " Username:", u)
} }
fmt.Fprintln(dockerCli.Out(), "Registry:", info.IndexServerAddress) fmt.Fprintln(dockerCli.Out(), " Registry:", info.IndexServerAddress)
} }
if info.Labels != nil { if info.Labels != nil {
fmt.Fprintln(dockerCli.Out(), "Labels:") fmt.Fprintln(dockerCli.Out(), " Labels:")
for _, lbl := range info.Labels { for _, lbl := range info.Labels {
fmt.Fprintln(dockerCli.Out(), " "+lbl) fmt.Fprintln(dockerCli.Out(), " "+lbl)
} }
} }
fmt.Fprintln(dockerCli.Out(), "Experimental:", info.ExperimentalBuild) fmt.Fprintln(dockerCli.Out(), " Experimental:", info.ExperimentalBuild)
fprintlnNonEmpty(dockerCli.Out(), "Cluster Store:", info.ClusterStore) fprintlnNonEmpty(dockerCli.Out(), " Cluster Store:", info.ClusterStore)
fprintlnNonEmpty(dockerCli.Out(), "Cluster Advertise:", info.ClusterAdvertise) fprintlnNonEmpty(dockerCli.Out(), " Cluster Advertise:", info.ClusterAdvertise)
if info.RegistryConfig != nil && (len(info.RegistryConfig.InsecureRegistryCIDRs) > 0 || len(info.RegistryConfig.IndexConfigs) > 0) { if info.RegistryConfig != nil && (len(info.RegistryConfig.InsecureRegistryCIDRs) > 0 || len(info.RegistryConfig.IndexConfigs) > 0) {
fmt.Fprintln(dockerCli.Out(), "Insecure Registries:") fmt.Fprintln(dockerCli.Out(), " Insecure Registries:")
for _, registry := range info.RegistryConfig.IndexConfigs { for _, registry := range info.RegistryConfig.IndexConfigs {
if !registry.Secure { if !registry.Secure {
fmt.Fprintln(dockerCli.Out(), " "+registry.Name) fmt.Fprintln(dockerCli.Out(), " "+registry.Name)
@ -197,20 +261,20 @@ func prettyPrintInfo(dockerCli command.Cli, info types.Info) error {
} }
if info.RegistryConfig != nil && len(info.RegistryConfig.Mirrors) > 0 { if info.RegistryConfig != nil && len(info.RegistryConfig.Mirrors) > 0 {
fmt.Fprintln(dockerCli.Out(), "Registry Mirrors:") fmt.Fprintln(dockerCli.Out(), " Registry Mirrors:")
for _, mirror := range info.RegistryConfig.Mirrors { for _, mirror := range info.RegistryConfig.Mirrors {
fmt.Fprintln(dockerCli.Out(), " "+mirror) fmt.Fprintln(dockerCli.Out(), " "+mirror)
} }
} }
fmt.Fprintln(dockerCli.Out(), "Live Restore Enabled:", info.LiveRestoreEnabled) fmt.Fprintln(dockerCli.Out(), " Live Restore Enabled:", info.LiveRestoreEnabled)
if info.ProductLicense != "" { if info.ProductLicense != "" {
fmt.Fprintln(dockerCli.Out(), "Product License:", info.ProductLicense) fmt.Fprintln(dockerCli.Out(), " Product License:", info.ProductLicense)
} }
fmt.Fprint(dockerCli.Out(), "\n") fmt.Fprint(dockerCli.Out(), "\n")
printWarnings(dockerCli, info) printServerWarnings(dockerCli, info)
return nil return errs
} }
// nolint: gocyclo // nolint: gocyclo
@ -283,22 +347,22 @@ func printSwarmInfo(dockerCli command.Cli, info types.Info) {
} }
} }
func printWarnings(dockerCli command.Cli, info types.Info) { func printServerWarnings(dockerCli command.Cli, info types.Info) {
if len(info.Warnings) > 0 { if len(info.Warnings) > 0 {
fmt.Fprintln(dockerCli.Err(), strings.Join(info.Warnings, "\n")) fmt.Fprintln(dockerCli.Err(), strings.Join(info.Warnings, "\n"))
return return
} }
// daemon didn't return warnings. Fallback to old behavior // daemon didn't return warnings. Fallback to old behavior
printStorageDriverWarnings(dockerCli, info) printStorageDriverWarnings(dockerCli, info)
printWarningsLegacy(dockerCli, info) printServerWarningsLegacy(dockerCli, info)
} }
// printWarningsLegacy generates warnings based on information returned by the daemon. // printServerWarningsLegacy generates warnings based on information returned by the daemon.
// DEPRECATED: warnings are now generated by the daemon, and returned in // DEPRECATED: warnings are now generated by the daemon, and returned in
// info.Warnings. This function is used to provide backward compatibility with // info.Warnings. This function is used to provide backward compatibility with
// daemons that do not provide these warnings. No new warnings should be added // daemons that do not provide these warnings. No new warnings should be added
// here. // here.
func printWarningsLegacy(dockerCli command.Cli, info types.Info) { func printServerWarningsLegacy(dockerCli command.Cli, info types.Info) {
if info.OSType == "windows" { if info.OSType == "windows" {
return return
} }
@ -382,7 +446,7 @@ func getBackingFs(info types.Info) string {
return "" return ""
} }
func formatInfo(dockerCli command.Cli, info types.Info, format string) error { func formatInfo(dockerCli command.Cli, info info, format string) error {
tmpl, err := templates.Parse(format) tmpl, err := templates.Parse(format)
if err != nil { if err != nil {
return cli.StatusError{StatusCode: 64, return cli.StatusError{StatusCode: 64,

View File

@ -21,8 +21,10 @@ func base64Decode(val string) []byte {
return decoded return decoded
} }
const sampleID = "EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX"
var sampleInfoNoSwarm = types.Info{ var sampleInfoNoSwarm = types.Info{
ID: "EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX", ID: sampleID,
Containers: 0, Containers: 0,
ContainersRunning: 0, ContainersRunning: 0,
ContainersPaused: 0, ContainersPaused: 0,
@ -222,44 +224,133 @@ func TestPrettyPrintInfo(t *testing.T) {
"WARNING: bridge-nf-call-ip6tables is disabled", "WARNING: bridge-nf-call-ip6tables is disabled",
} }
sampleInfoBadSecurity := sampleInfoNoSwarm
sampleInfoBadSecurity.SecurityOptions = []string{"foo="}
for _, tc := range []struct { for _, tc := range []struct {
doc string doc string
dockerInfo types.Info dockerInfo info
expectedGolden string prettyGolden string
warningsGolden string warningsGolden string
jsonGolden string
expectedError string
}{ }{
{ {
doc: "info without swarm", doc: "info without swarm",
dockerInfo: sampleInfoNoSwarm, dockerInfo: info{
expectedGolden: "docker-info-no-swarm", Info: &sampleInfoNoSwarm,
ClientInfo: &clientInfo{Debug: true},
},
prettyGolden: "docker-info-no-swarm",
jsonGolden: "docker-info-no-swarm",
}, },
{ {
doc: "info with swarm", doc: "info with swarm",
dockerInfo: infoWithSwarm, dockerInfo: info{
expectedGolden: "docker-info-with-swarm", Info: &infoWithSwarm,
ClientInfo: &clientInfo{Debug: false},
},
prettyGolden: "docker-info-with-swarm",
jsonGolden: "docker-info-with-swarm",
}, },
{ {
doc: "info with legacy warnings", doc: "info with legacy warnings",
dockerInfo: infoWithWarningsLinux, dockerInfo: info{
expectedGolden: "docker-info-no-swarm", Info: &infoWithWarningsLinux,
ClientInfo: &clientInfo{Debug: true},
},
prettyGolden: "docker-info-no-swarm",
warningsGolden: "docker-info-warnings", warningsGolden: "docker-info-warnings",
jsonGolden: "docker-info-legacy-warnings",
}, },
{ {
doc: "info with daemon warnings", doc: "info with daemon warnings",
dockerInfo: sampleInfoDaemonWarnings, dockerInfo: info{
expectedGolden: "docker-info-no-swarm", Info: &sampleInfoDaemonWarnings,
ClientInfo: &clientInfo{Debug: true},
},
prettyGolden: "docker-info-no-swarm",
warningsGolden: "docker-info-warnings", warningsGolden: "docker-info-warnings",
jsonGolden: "docker-info-daemon-warnings",
},
{
doc: "errors for both",
dockerInfo: info{
ServerErrors: []string{"a server error occurred"},
ClientErrors: []string{"a client error occurred"},
},
prettyGolden: "docker-info-errors",
jsonGolden: "docker-info-errors",
expectedError: "errors pretty printing info",
},
{
doc: "bad security info",
dockerInfo: info{
Info: &sampleInfoBadSecurity,
ServerErrors: []string{"an error happened"},
ClientInfo: &clientInfo{Debug: false},
},
prettyGolden: "docker-info-badsec",
jsonGolden: "docker-info-badsec",
expectedError: "errors pretty printing info",
}, },
} { } {
t.Run(tc.doc, func(t *testing.T) { t.Run(tc.doc, func(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{}) cli := test.NewFakeCli(&fakeClient{})
assert.NilError(t, prettyPrintInfo(cli, tc.dockerInfo)) err := prettyPrintInfo(cli, tc.dockerInfo)
golden.Assert(t, cli.OutBuffer().String(), tc.expectedGolden+".golden") if tc.expectedError == "" {
assert.NilError(t, err)
} else {
assert.Error(t, err, tc.expectedError)
}
golden.Assert(t, cli.OutBuffer().String(), tc.prettyGolden+".golden")
if tc.warningsGolden != "" { if tc.warningsGolden != "" {
golden.Assert(t, cli.ErrBuffer().String(), tc.warningsGolden+".golden") golden.Assert(t, cli.ErrBuffer().String(), tc.warningsGolden+".golden")
} else { } else {
assert.Check(t, is.Equal("", cli.ErrBuffer().String())) assert.Check(t, is.Equal("", cli.ErrBuffer().String()))
} }
cli = test.NewFakeCli(&fakeClient{})
assert.NilError(t, formatInfo(cli, tc.dockerInfo, "{{json .}}"))
golden.Assert(t, cli.OutBuffer().String(), tc.jsonGolden+".json.golden")
assert.Check(t, is.Equal("", cli.ErrBuffer().String()))
})
}
}
func TestFormatInfo(t *testing.T) {
for _, tc := range []struct {
doc string
template string
expectedError string
expectedOut string
}{
{
doc: "basic",
template: "{{.ID}}",
expectedOut: sampleID + "\n",
},
{
doc: "syntax",
template: "{{}",
expectedError: `Status: Template parsing error: template: :1: unexpected "}" in command, Code: 64`,
},
} {
t.Run(tc.doc, func(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{})
info := info{
Info: &sampleInfoNoSwarm,
ClientInfo: &clientInfo{Debug: true},
}
err := formatInfo(cli, info, tc.template)
if tc.expectedOut != "" {
assert.NilError(t, err)
assert.Equal(t, cli.OutBuffer().String(), tc.expectedOut)
} else if tc.expectedError != "" {
assert.Error(t, err, tc.expectedError)
} else {
t.Fatal("test expected to neither pass nor fail")
}
}) })
} }
} }

View File

@ -0,0 +1,52 @@
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.06.1-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Kernel Version: 4.4.0-87-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.953GiB
Name: system-sample
ID: EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX
Docker Root Dir: /var/lib/docker
Debug Mode: true
File Descriptors: 33
Goroutines: 135
System Time: 2017-08-24T17:44:34.077811894Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Labels:
provider=digitalocean
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
ERROR: an error happened
ERROR: invalid empty security option

View File

@ -0,0 +1 @@
{"ID":"EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"aufs","DriverStatus":[["Root Dir","/var/lib/docker/aufs"],["Backing Filesystem","extfs"],["Dirs","0"],["Dirperm1 Supported","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","logentries","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"KernelMemoryTCP":false,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"IPv4Forwarding":true,"BridgeNfIptables":true,"BridgeNfIp6tables":true,"Debug":true,"NFd":33,"OomKillDisable":true,"NGoroutines":135,"SystemTime":"2017-08-24T17:44:34.077811894Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":0,"KernelVersion":"4.4.0-87-generic","OperatingSystem":"Ubuntu 16.04.3 LTS","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":null,"AllowNondistributableArtifactsHostnames":null,"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":null,"Secure":true,"Official":true}},"Mirrors":null},"NCPU":2,"MemTotal":2097356800,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"system-sample","Labels":["provider=digitalocean"],"ExperimentalBuild":false,"ServerVersion":"17.06.1-ce","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"6e23458c129b551d5c9871e5174f6b1b7f6d1170","Expected":"6e23458c129b551d5c9871e5174f6b1b7f6d1170"},"RuncCommit":{"ID":"810190ceaa507aa2727d7ae6f4790c76ec150bd2","Expected":"810190ceaa507aa2727d7ae6f4790c76ec150bd2"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["foo="],"Warnings":null,"ServerErrors":["an error happened"],"ClientInfo":{"Debug":false,"Warnings":null}}

View File

@ -0,0 +1 @@
{"ID":"EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"aufs","DriverStatus":[["Root Dir","/var/lib/docker/aufs"],["Backing Filesystem","extfs"],["Dirs","0"],["Dirperm1 Supported","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","logentries","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"KernelMemoryTCP":false,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"IPv4Forwarding":true,"BridgeNfIptables":true,"BridgeNfIp6tables":true,"Debug":true,"NFd":33,"OomKillDisable":true,"NGoroutines":135,"SystemTime":"2017-08-24T17:44:34.077811894Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":0,"KernelVersion":"4.4.0-87-generic","OperatingSystem":"Ubuntu 16.04.3 LTS","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":null,"AllowNondistributableArtifactsHostnames":null,"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":null,"Secure":true,"Official":true}},"Mirrors":null},"NCPU":2,"MemTotal":2097356800,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"system-sample","Labels":["provider=digitalocean"],"ExperimentalBuild":false,"ServerVersion":"17.06.1-ce","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"6e23458c129b551d5c9871e5174f6b1b7f6d1170","Expected":"6e23458c129b551d5c9871e5174f6b1b7f6d1170"},"RuncCommit":{"ID":"810190ceaa507aa2727d7ae6f4790c76ec150bd2","Expected":"810190ceaa507aa2727d7ae6f4790c76ec150bd2"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["name=apparmor","name=seccomp,profile=default"],"Warnings":["WARNING: No memory limit support","WARNING: No swap limit support","WARNING: No kernel memory limit support","WARNING: No oom kill disable support","WARNING: No cpu cfs quota support","WARNING: No cpu cfs period support","WARNING: No cpu shares support","WARNING: No cpuset support","WARNING: IPv4 forwarding is disabled","WARNING: bridge-nf-call-iptables is disabled","WARNING: bridge-nf-call-ip6tables is disabled"],"ClientInfo":{"Debug":true,"Warnings":null}}

View File

@ -0,0 +1,5 @@
Client:
ERROR: a client error occurred
Server:
ERROR: a server error occurred

View File

@ -0,0 +1 @@
{"ServerErrors":["a server error occurred"],"ClientErrors":["a client error occurred"]}

View File

@ -0,0 +1 @@
{"ID":"EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"aufs","DriverStatus":[["Root Dir","/var/lib/docker/aufs"],["Backing Filesystem","extfs"],["Dirs","0"],["Dirperm1 Supported","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","logentries","splunk","syslog"]},"MemoryLimit":false,"SwapLimit":false,"KernelMemory":false,"KernelMemoryTCP":false,"CpuCfsPeriod":false,"CpuCfsQuota":false,"CPUShares":false,"CPUSet":false,"IPv4Forwarding":false,"BridgeNfIptables":false,"BridgeNfIp6tables":false,"Debug":true,"NFd":33,"OomKillDisable":false,"NGoroutines":135,"SystemTime":"2017-08-24T17:44:34.077811894Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":0,"KernelVersion":"4.4.0-87-generic","OperatingSystem":"Ubuntu 16.04.3 LTS","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":null,"AllowNondistributableArtifactsHostnames":null,"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":null,"Secure":true,"Official":true}},"Mirrors":null},"NCPU":2,"MemTotal":2097356800,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"system-sample","Labels":["provider=digitalocean"],"ExperimentalBuild":false,"ServerVersion":"17.06.1-ce","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"6e23458c129b551d5c9871e5174f6b1b7f6d1170","Expected":"6e23458c129b551d5c9871e5174f6b1b7f6d1170"},"RuncCommit":{"ID":"810190ceaa507aa2727d7ae6f4790c76ec150bd2","Expected":"810190ceaa507aa2727d7ae6f4790c76ec150bd2"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["name=apparmor","name=seccomp,profile=default"],"Warnings":null,"ClientInfo":{"Debug":true,"Warnings":null}}

View File

@ -1,51 +1,54 @@
Containers: 0 Client:
Debug Mode: true
Server:
Containers: 0
Running: 0 Running: 0
Paused: 0 Paused: 0
Stopped: 0 Stopped: 0
Images: 0 Images: 0
Server Version: 17.06.1-ce Server Version: 17.06.1-ce
Storage Driver: aufs Storage Driver: aufs
Root Dir: /var/lib/docker/aufs Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs Backing Filesystem: extfs
Dirs: 0 Dirs: 0
Dirperm1 Supported: true Dirperm1 Supported: true
Logging Driver: json-file Logging Driver: json-file
Cgroup Driver: cgroupfs Cgroup Driver: cgroupfs
Plugins: Plugins:
Volume: local Volume: local
Network: bridge host macvlan null overlay Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive Swarm: inactive
Runtimes: runc Runtimes: runc
Default Runtime: runc Default Runtime: runc
Init Binary: docker-init Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170 containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2 runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa init version: 949e6fa
Security Options: Security Options:
apparmor apparmor
seccomp seccomp
Profile: default Profile: default
Kernel Version: 4.4.0-87-generic Kernel Version: 4.4.0-87-generic
Operating System: Ubuntu 16.04.3 LTS Operating System: Ubuntu 16.04.3 LTS
OSType: linux OSType: linux
Architecture: x86_64 Architecture: x86_64
CPUs: 2 CPUs: 2
Total Memory: 1.953GiB Total Memory: 1.953GiB
Name: system-sample Name: system-sample
ID: EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX ID: EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX
Docker Root Dir: /var/lib/docker Docker Root Dir: /var/lib/docker
Debug Mode (client): false Debug Mode: true
Debug Mode (server): true
File Descriptors: 33 File Descriptors: 33
Goroutines: 135 Goroutines: 135
System Time: 2017-08-24T17:44:34.077811894Z System Time: 2017-08-24T17:44:34.077811894Z
EventsListeners: 0 EventsListeners: 0
Registry: https://index.docker.io/v1/ Registry: https://index.docker.io/v1/
Labels: Labels:
provider=digitalocean provider=digitalocean
Experimental: false Experimental: false
Insecure Registries: Insecure Registries:
127.0.0.0/8 127.0.0.0/8
Live Restore Enabled: false Live Restore Enabled: false

View File

@ -0,0 +1 @@
{"ID":"EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"aufs","DriverStatus":[["Root Dir","/var/lib/docker/aufs"],["Backing Filesystem","extfs"],["Dirs","0"],["Dirperm1 Supported","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","logentries","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"KernelMemoryTCP":false,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"IPv4Forwarding":true,"BridgeNfIptables":true,"BridgeNfIp6tables":true,"Debug":true,"NFd":33,"OomKillDisable":true,"NGoroutines":135,"SystemTime":"2017-08-24T17:44:34.077811894Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":0,"KernelVersion":"4.4.0-87-generic","OperatingSystem":"Ubuntu 16.04.3 LTS","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":null,"AllowNondistributableArtifactsHostnames":null,"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":null,"Secure":true,"Official":true}},"Mirrors":null},"NCPU":2,"MemTotal":2097356800,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"system-sample","Labels":["provider=digitalocean"],"ExperimentalBuild":false,"ServerVersion":"17.06.1-ce","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"6e23458c129b551d5c9871e5174f6b1b7f6d1170","Expected":"6e23458c129b551d5c9871e5174f6b1b7f6d1170"},"RuncCommit":{"ID":"810190ceaa507aa2727d7ae6f4790c76ec150bd2","Expected":"810190ceaa507aa2727d7ae6f4790c76ec150bd2"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["name=apparmor","name=seccomp,profile=default"],"Warnings":null,"ClientInfo":{"Debug":true,"Warnings":null}}

View File

@ -1,21 +1,25 @@
Containers: 0 Client:
Debug Mode: false
Server:
Containers: 0
Running: 0 Running: 0
Paused: 0 Paused: 0
Stopped: 0 Stopped: 0
Images: 0 Images: 0
Server Version: 17.06.1-ce Server Version: 17.06.1-ce
Storage Driver: aufs Storage Driver: aufs
Root Dir: /var/lib/docker/aufs Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs Backing Filesystem: extfs
Dirs: 0 Dirs: 0
Dirperm1 Supported: true Dirperm1 Supported: true
Logging Driver: json-file Logging Driver: json-file
Cgroup Driver: cgroupfs Cgroup Driver: cgroupfs
Plugins: Plugins:
Volume: local Volume: local
Network: bridge host macvlan null overlay Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active Swarm: active
NodeID: qo2dfdig9mmxqkawulggepdih NodeID: qo2dfdig9mmxqkawulggepdih
Is Manager: true Is Manager: true
ClusterID: 9vs5ygs0gguyyec4iqf2314c0 ClusterID: 9vs5ygs0gguyyec4iqf2314c0
@ -38,36 +42,35 @@ Swarm: active
Node Address: 165.227.107.89 Node Address: 165.227.107.89
Manager Addresses: Manager Addresses:
165.227.107.89:2377 165.227.107.89:2377
Runtimes: runc Runtimes: runc
Default Runtime: runc Default Runtime: runc
Init Binary: docker-init Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170 containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2 runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa init version: 949e6fa
Security Options: Security Options:
apparmor apparmor
seccomp seccomp
Profile: default Profile: default
Kernel Version: 4.4.0-87-generic Kernel Version: 4.4.0-87-generic
Operating System: Ubuntu 16.04.3 LTS Operating System: Ubuntu 16.04.3 LTS
OSType: linux OSType: linux
Architecture: x86_64 Architecture: x86_64
CPUs: 2 CPUs: 2
Total Memory: 1.953GiB Total Memory: 1.953GiB
Name: system-sample Name: system-sample
ID: EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX ID: EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX
Docker Root Dir: /var/lib/docker Docker Root Dir: /var/lib/docker
Debug Mode (client): false Debug Mode: true
Debug Mode (server): true
File Descriptors: 33 File Descriptors: 33
Goroutines: 135 Goroutines: 135
System Time: 2017-08-24T17:44:34.077811894Z System Time: 2017-08-24T17:44:34.077811894Z
EventsListeners: 0 EventsListeners: 0
Registry: https://index.docker.io/v1/ Registry: https://index.docker.io/v1/
Labels: Labels:
provider=digitalocean provider=digitalocean
Experimental: false Experimental: false
Insecure Registries: Insecure Registries:
127.0.0.0/8 127.0.0.0/8
Live Restore Enabled: false Live Restore Enabled: false

View File

@ -0,0 +1 @@
{"ID":"EKHL:QDUU:QZ7U:MKGD:VDXK:S27Q:GIPU:24B7:R7VT:DGN6:QCSF:2UBX","Containers":0,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":0,"Images":0,"Driver":"aufs","DriverStatus":[["Root Dir","/var/lib/docker/aufs"],["Backing Filesystem","extfs"],["Dirs","0"],["Dirperm1 Supported","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","logentries","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"KernelMemoryTCP":false,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"IPv4Forwarding":true,"BridgeNfIptables":true,"BridgeNfIp6tables":true,"Debug":true,"NFd":33,"OomKillDisable":true,"NGoroutines":135,"SystemTime":"2017-08-24T17:44:34.077811894Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":0,"KernelVersion":"4.4.0-87-generic","OperatingSystem":"Ubuntu 16.04.3 LTS","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":null,"AllowNondistributableArtifactsHostnames":null,"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":null,"Secure":true,"Official":true}},"Mirrors":null},"NCPU":2,"MemTotal":2097356800,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"system-sample","Labels":["provider=digitalocean"],"ExperimentalBuild":false,"ServerVersion":"17.06.1-ce","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"qo2dfdig9mmxqkawulggepdih","NodeAddr":"165.227.107.89","LocalNodeState":"active","ControlAvailable":true,"Error":"","RemoteManagers":[{"NodeID":"qo2dfdig9mmxqkawulggepdih","Addr":"165.227.107.89:2377"}],"Nodes":1,"Managers":1,"Cluster":{"ID":"9vs5ygs0gguyyec4iqf2314c0","Version":{"Index":11},"CreatedAt":"2017-08-24T17:34:19.278062352Z","UpdatedAt":"2017-08-24T17:34:42.398815481Z","Spec":{"Name":"default","Labels":null,"Orchestration":{"TaskHistoryRetentionLimit":5},"Raft":{"SnapshotInterval":10000,"KeepOldSnapshots":0,"LogEntriesForSlowFollowers":500,"ElectionTick":3,"HeartbeatTick":1},"Dispatcher":{"HeartbeatPeriod":5000000000},"CAConfig":{"NodeCertExpiry":7776000000000000},"TaskDefaults":{},"EncryptionConfig":{"AutoLockManagers":true}},"TLSInfo":{"TrustRoot":"\n-----BEGIN CERTIFICATE-----\nMIIBajCCARCgAwIBAgIUaFCW5xsq8eyiJ+Pmcv3MCflMLnMwCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwODI0MTcyOTAwWhcNMzcwODE5MTcy\nOTAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABDy7NebyUJyUjWJDBUdnZoV6GBxEGKO4TZPNDwnxDxJcUdLVaB7WGa4/DLrW\nUfsVgh1JGik2VTiLuTMA1tLlNPOjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBQl16XFtaaXiUAwEuJptJlDjfKskDAKBggqhkjO\nPQQDAgNIADBFAiEAo9fTQNM5DP9bHVcTJYfl2Cay1bFu1E+lnpmN+EYJfeACIGKH\n1pCUkZ+D0IB6CiEZGWSHyLuXPM1rlP+I5KuS7sB8\n-----END CERTIFICATE-----\n","CertIssuerSubject":"MBMxETAPBgNVBAMTCHN3YXJtLWNh","CertIssuerPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEPLs15vJQnJSNYkMFR2dmhXoYHEQYo7hNk80PCfEPElxR0tVoHtYZrj8MutZR+xWCHUkaKTZVOIu5MwDW0uU08w=="},"RootRotationInProgress":false,"DefaultAddrPool":null,"SubnetSize":0,"DataPathPort":0}},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"6e23458c129b551d5c9871e5174f6b1b7f6d1170","Expected":"6e23458c129b551d5c9871e5174f6b1b7f6d1170"},"RuncCommit":{"ID":"810190ceaa507aa2727d7ae6f4790c76ec150bd2","Expected":"810190ceaa507aa2727d7ae6f4790c76ec150bd2"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["name=apparmor","name=seccomp,profile=default"],"Warnings":null,"ClientInfo":{"Debug":false,"Warnings":null}}

View File

@ -55,14 +55,17 @@ information about the `devicemapper` storage driver is shown:
```bash ```bash
$ docker info $ docker info
Client:
Debug Mode: false
Containers: 14 Server:
Containers: 14
Running: 3 Running: 3
Paused: 1 Paused: 1
Stopped: 10 Stopped: 10
Images: 52 Images: 52
Server Version: 1.10.3 Server Version: 1.10.3
Storage Driver: devicemapper Storage Driver: devicemapper
Pool Name: docker-202:2-25583803-pool Pool Name: docker-202:2-25583803-pool
Pool Blocksize: 65.54 kB Pool Blocksize: 65.54 kB
Base Device Size: 10.74 GB Base Device Size: 10.74 GB
@ -82,25 +85,24 @@ Storage Driver: devicemapper
Data loop file: /var/lib/docker/devicemapper/devicemapper/data Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.107-RHEL7 (2015-12-01) Library Version: 1.02.107-RHEL7 (2015-12-01)
Execution Driver: native-0.2 Execution Driver: native-0.2
Logging Driver: json-file Logging Driver: json-file
Plugins: Plugins:
Volume: local Volume: local
Network: null host bridge Network: null host bridge
Kernel Version: 3.10.0-327.el7.x86_64 Kernel Version: 3.10.0-327.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo) Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
OSType: linux OSType: linux
Architecture: x86_64 Architecture: x86_64
CPUs: 1 CPUs: 1
Total Memory: 991.7 MiB Total Memory: 991.7 MiB
Name: ip-172-30-0-91.ec2.internal Name: ip-172-30-0-91.ec2.internal
ID: I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S ID: I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S
Docker Root Dir: /var/lib/docker Docker Root Dir: /var/lib/docker
Debug mode (client): false Debug Mode: false
Debug mode (server): false Username: gordontheturtle
Username: gordontheturtle Registry: https://index.docker.io/v1/
Registry: https://index.docker.io/v1/ Insecure registries:
Insecure registries:
myinsecurehost:5000 myinsecurehost:5000
127.0.0.0/8 127.0.0.0/8
``` ```
@ -112,23 +114,26 @@ storage driver and a node that is part of a 2-node swarm:
```bash ```bash
$ docker -D info $ docker -D info
Client:
Debug Mode: true
Containers: 14 Server:
Containers: 14
Running: 3 Running: 3
Paused: 1 Paused: 1
Stopped: 10 Stopped: 10
Images: 52 Images: 52
Server Version: 1.13.0 Server Version: 1.13.0
Storage Driver: overlay2 Storage Driver: overlay2
Backing Filesystem: extfs Backing Filesystem: extfs
Supports d_type: true Supports d_type: true
Native Overlay Diff: false Native Overlay Diff: false
Logging Driver: json-file Logging Driver: json-file
Cgroup Driver: cgroupfs Cgroup Driver: cgroupfs
Plugins: Plugins:
Volume: local Volume: local
Network: bridge host macvlan null overlay Network: bridge host macvlan null overlay
Swarm: active Swarm: active
NodeID: rdjq45w1op418waxlairloqbm NodeID: rdjq45w1op418waxlairloqbm
Is Manager: true Is Manager: true
ClusterID: te8kdyw33n36fqiz74bfjeixd ClusterID: te8kdyw33n36fqiz74bfjeixd
@ -149,46 +154,45 @@ Swarm: active
Node Address: 172.16.66.128 172.16.66.129 Node Address: 172.16.66.128 172.16.66.129
Manager Addresses: Manager Addresses:
172.16.66.128:2477 172.16.66.128:2477
Runtimes: runc Runtimes: runc
Default Runtime: runc Default Runtime: runc
Init Binary: docker-init Init Binary: docker-init
containerd version: 8517738ba4b82aff5662c97ca4627e7e4d03b531 containerd version: 8517738ba4b82aff5662c97ca4627e7e4d03b531
runc version: ac031b5bf1cc92239461125f4c1ffb760522bbf2 runc version: ac031b5bf1cc92239461125f4c1ffb760522bbf2
init version: N/A (expected: v0.13.0) init version: N/A (expected: v0.13.0)
Security Options: Security Options:
apparmor apparmor
seccomp seccomp
Profile: default Profile: default
Kernel Version: 4.4.0-31-generic Kernel Version: 4.4.0-31-generic
Operating System: Ubuntu 16.04.1 LTS Operating System: Ubuntu 16.04.1 LTS
OSType: linux OSType: linux
Architecture: x86_64 Architecture: x86_64
CPUs: 2 CPUs: 2
Total Memory: 1.937 GiB Total Memory: 1.937 GiB
Name: ubuntu Name: ubuntu
ID: H52R:7ZR6:EIIA:76JG:ORIY:BVKF:GSFU:HNPG:B5MK:APSC:SZ3Q:N326 ID: H52R:7ZR6:EIIA:76JG:ORIY:BVKF:GSFU:HNPG:B5MK:APSC:SZ3Q:N326
Docker Root Dir: /var/lib/docker Docker Root Dir: /var/lib/docker
Debug Mode (client): true Debug Mode: true
Debug Mode (server): true
File Descriptors: 30 File Descriptors: 30
Goroutines: 123 Goroutines: 123
System Time: 2016-11-12T17:24:37.955404361-08:00 System Time: 2016-11-12T17:24:37.955404361-08:00
EventsListeners: 0 EventsListeners: 0
Http Proxy: http://test:test@proxy.example.com:8080 Http Proxy: http://test:test@proxy.example.com:8080
Https Proxy: https://test:test@proxy.example.com:8080 Https Proxy: https://test:test@proxy.example.com:8080
No Proxy: localhost,127.0.0.1,docker-registry.somecorporation.com No Proxy: localhost,127.0.0.1,docker-registry.somecorporation.com
Registry: https://index.docker.io/v1/ Registry: https://index.docker.io/v1/
WARNING: No swap limit support WARNING: No swap limit support
Labels: Labels:
storage=ssd storage=ssd
staging=true staging=true
Experimental: false Experimental: false
Insecure Registries: Insecure Registries:
127.0.0.0/8 127.0.0.0/8
Registry Mirrors: Registry Mirrors:
http://192.168.1.2/ http://192.168.1.2/
http://registry-mirror.example.com:5000/ http://registry-mirror.example.com:5000/
Live Restore Enabled: false Live Restore Enabled: false
``` ```
The global `-D` option causes all `docker` commands to output debug information. The global `-D` option causes all `docker` commands to output debug information.
@ -209,37 +213,39 @@ Here is a sample output for a daemon running on Windows Server 2016:
```none ```none
E:\docker>docker info E:\docker>docker info
Client:
Debug Mode: false
Containers: 1 Server:
Containers: 1
Running: 0 Running: 0
Paused: 0 Paused: 0
Stopped: 1 Stopped: 1
Images: 17 Images: 17
Server Version: 1.13.0 Server Version: 1.13.0
Storage Driver: windowsfilter Storage Driver: windowsfilter
Windows: Windows:
Logging Driver: json-file Logging Driver: json-file
Plugins: Plugins:
Volume: local Volume: local
Network: nat null overlay Network: nat null overlay
Swarm: inactive Swarm: inactive
Default Isolation: process Default Isolation: process
Kernel Version: 10.0 14393 (14393.206.amd64fre.rs1_release.160912-1937) Kernel Version: 10.0 14393 (14393.206.amd64fre.rs1_release.160912-1937)
Operating System: Windows Server 2016 Datacenter Operating System: Windows Server 2016 Datacenter
OSType: windows OSType: windows
Architecture: x86_64 Architecture: x86_64
CPUs: 8 CPUs: 8
Total Memory: 3.999 GiB Total Memory: 3.999 GiB
Name: WIN-V0V70C0LU5P Name: WIN-V0V70C0LU5P
ID: NYMS:B5VK:UMSL:FVDZ:EWB5:FKVK:LPFL:FJMQ:H6FT:BZJ6:L2TD:XH62 ID: NYMS:B5VK:UMSL:FVDZ:EWB5:FKVK:LPFL:FJMQ:H6FT:BZJ6:L2TD:XH62
Docker Root Dir: C:\control Docker Root Dir: C:\control
Debug Mode (client): false Debug Mode: false
Debug Mode (server): false Registry: https://index.docker.io/v1/
Registry: https://index.docker.io/v1/ Insecure Registries:
Insecure Registries:
127.0.0.0/8 127.0.0.0/8
Registry Mirrors: Registry Mirrors:
http://192.168.1.2/ http://192.168.1.2/
http://registry-mirror.example.com:5000/ http://registry-mirror.example.com:5000/
Live Restore Enabled: false Live Restore Enabled: false
``` ```

View File

@ -24,6 +24,10 @@ Here is a sample output for a daemon running on Ubuntu, using the overlay2
storage driver: storage driver:
$ docker -D info $ docker -D info
Client:
Debug Mode: true
Server:
Containers: 14 Containers: 14
Running: 3 Running: 3
Paused: 1 Paused: 1
@ -78,8 +82,7 @@ storage driver:
Name: ubuntu Name: ubuntu
ID: H52R:7ZR6:EIIA:76JG:ORIY:BVKF:GSFU:HNPG:B5MK:APSC:SZ3Q:N326 ID: H52R:7ZR6:EIIA:76JG:ORIY:BVKF:GSFU:HNPG:B5MK:APSC:SZ3Q:N326
Docker Root Dir: /var/lib/docker Docker Root Dir: /var/lib/docker
Debug Mode (client): true Debug Mode: true
Debug Mode (server): true
File Descriptors: 30 File Descriptors: 30
Goroutines: 123 Goroutines: 123
System Time: 2016-11-12T17:24:37.955404361-08:00 System Time: 2016-11-12T17:24:37.955404361-08:00
@ -109,6 +112,10 @@ using the devicemapper storage driver. As can be seen in the output, additional
information about the devicemapper storage driver is shown: information about the devicemapper storage driver is shown:
$ docker info $ docker info
Client:
Debug Mode: false
Server:
Containers: 14 Containers: 14
Running: 3 Running: 3
Paused: 1 Paused: 1
@ -149,8 +156,7 @@ information about the devicemapper storage driver is shown:
Name: ip-172-30-0-91.ec2.internal Name: ip-172-30-0-91.ec2.internal
ID: I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S ID: I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S
Docker Root Dir: /var/lib/docker Docker Root Dir: /var/lib/docker
Debug mode (client): false Debug Mode: false
Debug mode (server): false
Username: gordontheturtle Username: gordontheturtle
Registry: https://index.docker.io/v1/ Registry: https://index.docker.io/v1/
Insecure registries: Insecure registries: