Skip to content

docker info --format panic #3593

@rumpl

Description

@rumpl

Description

The cli panics when I run docker info --format '{{.LoggingDriver}}' while the daemon is not running.

Steps to reproduce the issue:

  1. stop the daemon
  2. run docker info --format '{{.LoggingDriver}}'

Describe the results you received:

panic: reflect: indirection through nil pointer to embedded struct [recovered]
	panic: reflect: indirection through nil pointer to embedded struct

goroutine 1 [running]:
text/template.errRecover(0xc0007972e8)
	/usr/local/go/src/text/template/exec.go:169 +0x1c5
panic(0x10ec3d780, 0x10ef37608)
	/usr/local/go/src/runtime/panic.go:965 +0x1b9
reflect.Value.FieldByIndex(0x10edd5720, 0xc000a10100, 0x99, 0xc0007b8230, 0x2, 0x2, 0x0, 0x10efc66e8, 0x10ec3d780)
	/usr/local/go/src/reflect/value.go:889 +0x325
text/template.(*state).evalField(0xc000797258, 0x10edd5720, 0xc000a10100, 0x99, 0x7ff7b2c56537, 0xd, 0x10efb0300, 0xc000a143c0, 0xc000230120, 0x1, ...)
	/usr/local/go/src/text/template/exec.go:616 +0x4ed
text/template.(*state).evalFieldChain(0xc000797258, 0x10edd5720, 0xc000a10100, 0x99, 0x10edd5720, 0xc000a10100, 0x99, 0x10efb0300, 0xc000a143c0, 0xc000230110, ...)
	/usr/local/go/src/text/template/exec.go:569 +0x225
text/template.(*state).evalFieldNode(0xc000797258, 0x10edd5720, 0xc000a10100, 0x99, 0xc000a143c0, 0xc000230120, 0x1, 0x1, 0x10eccbe40, 0x10fd457b0, ...)
	/usr/local/go/src/text/template/exec.go:533 +0x113
text/template.(*state).evalCommand(0xc000797258, 0x10edd5720, 0xc000a10100, 0x99, 0xc000a14390, 0x10eccbe40, 0x10fd457b0, 0x99, 0xd0, 0xc0007b2820, ...)
	/usr/local/go/src/text/template/exec.go:461 +0x8f0
text/template.(*state).evalPipeline(0xc000797258, 0x10edd5720, 0xc000a10100, 0x99, 0xc000a16660, 0x10d8d91b6, 0xc0000c0378, 0xc000a100c0)
	/usr/local/go/src/text/template/exec.go:435 +0x125
text/template.(*state).walk(0xc000797258, 0x10edd5720, 0xc000a10100, 0x99, 0x10efb0108, 0xc000a143f0)
	/usr/local/go/src/text/template/exec.go:254 +0x38a
text/template.(*state).walk(0xc000797258, 0x10edd5720, 0xc000a10100, 0x99, 0x10efb03d8, 0xc000a14360)
	/usr/local/go/src/text/template/exec.go:263 +0x13c
text/template.(*Template).execute(0xc000a100c0, 0x10ef56bd8, 0xc00021b6e0, 0x10edd5720, 0xc000a10100, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:217 +0x1c6
text/template.(*Template).Execute(...)
	/usr/local/go/src/text/template/exec.go:200
github.com/docker/cli/cli/command/system.formatInfo(0x10efc35a8, 0xc0004b0410, 0x0, 0xc0007a2010, 0x1, 0x1, 0xc0007aa000, 0x0, 0x0, 0x0, ...)
	/go/src/github.com/docker/cli/cli/command/system/info.go:511 +0x1fd
github.com/docker/cli/cli/command/system.runInfo(0xc0004238c0, 0x10efc35a8, 0xc0004b0410, 0xc00042c1f0, 0x0, 0x0)
	/go/src/github.com/docker/cli/cli/command/system/info.go:88 +0x3a5
github.com/docker/cli/cli/command/system.NewInfoCommand.func1(0xc0004238c0, 0xc0009ab300, 0x0, 0x2, 0x0, 0x0)
	/go/src/github.com/docker/cli/cli/command/system/info.go:54 +0x46
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc0004238c0, 0xc000427cf0, 0x2, 0x2, 0xc0004238c0, 0xc000427cf0)
	/go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:850 +0x472
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0001ea580, 0xc000427ce0, 0x3, 0x3)
	/go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:958 +0x375
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
	/go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:895
main.runDocker(0xc0004b0410, 0x10ef59138, 0xc000010020)
	/go/src/github.com/docker/cli/cmd/docker/docker.go:287 +0x1eb
main.main()
	/go/src/github.com/docker/cli/cmd/docker/docker.go:298 +0xfc

Describe the results you expected:

I would expect an error message saying that the engine is not running.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

❯ docker version
Client:
 Cloud integration: v1.0.24
 Version:           20.10.14
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 24 01:49:20 2022
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.8.0 (78653)
 Engine:
  Version:          20.10.14
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.15
  Git commit:       87a90dc
  Built:            Thu Mar 24 01:46:14 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.11
  GitCommit:        3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc:
  Version:          1.0.3
  GitCommit:        v1.0.3-0-gf46b6ba
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.5.0)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 20
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc version: v1.0.3-0-gf46b6ba
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 7.676GiB
 Name: docker-desktop
 ID: HTHB:QB5O:AI5F:CQLN:XY7W:5C4M:25BF:WXJK:ZE2O:XOKF:EKZC:A3EH
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions