profile
viewpoint

Ask questionsPanic: runtime error: invalid memory address or nil pointer dereference

My OsInfo

Linux ubuntu-18-04-template.host.com 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

My Docker-info

docker version
Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:53:11 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false
root@ubuntu-18-04-template:/var/lib/docker# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.09.3
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: 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 local logentries splunk syslog
Swarm: pending
 NodeID: i55d8vmqbm4a2b6j3rgm2cs3q
 Error: rpc error: code = Unknown desc = The swarm does not have a leader. It's possible that too few managers are online. Make sure more than half of the managers are online.
 Is Manager: true
 Node Address: 192.168.100.100
 Manager Addresses:
  10.10.220.69:2377
  10.10.220.70:2377
  10.10.220.71:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-29-generic
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 962MiB
Name: ubuntu-18-04-template.host.com
ID: SBDP:SXFU:WBCK:X7X2:SVCK:ICFG:S6R7:7UAI:WYAV:OM25:VFWW:MCRH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Registry Mirrors:
 https://registry.docker-cn.com/
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support


What i did:

  • I want to recover my swarm cluster from the disaster cluster.
  1. Copy /var/lib/docker/swarm From a cluster-manager To my current machine.
  2. Cover my current /var/lib/docker/swarm dic.
  3. start docker
  4. docker swarm init --force-new-cluster

Error Log

May 15 17:35:41 ubuntu-18-04-template.host.com dockerd[2786]: time="2019-05-15T17:35:41.469859137+08:00" level=info msg="leadership changed from not yet part of a raft cluster to i55d8vmqbm4a2b6j3rgm2cs3q" module=node node.id=i55d8vmqbm4a2b6j3rgm2cs3q
May 15 17:35:41 ubuntu-18-04-template.host.com dockerd[2786]: time="2019-05-15T17:35:41.470809320+08:00" level=info msg="dispatcher starting" module=dispatcher node.id=i55d8vmqbm4a2b6j3rgm2cs3q
May 15 17:35:41 ubuntu-18-04-template.host.com dockerd[2786]: time="2019-05-15T17:35:41.736683837+08:00" level=warning msg="election tick value (10s) is different from the one defined in the cluster config (3s), the cluster may be unstable" module=node node.id=i55d8vmqbm4a2b6j3rgm2cs3q
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: time="2019-05-15T17:35:42.038499000+08:00" level=info msg="worker i55d8vmqbm4a2b6j3rgm2cs3q was successfully registered" method="(*Dispatcher).register"
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: panic: runtime error: invalid memory address or nil pointer dereference
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x55fea00d25ec]
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: goroutine 256 [running]:
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.(*Allocator).allocateNode(0xc44dfc62c0, 0x55fea0e85a80, 0xc42c4310c0, 0xc45106f900, 0x0, 0xc45112c740, 0x5, 0x8, 0xc4510bf860)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/network.go:1045 +0x53c
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.(*Allocator).allocateNodes(0xc44dfc62c0, 0x55fea0e85a80, 0xc42c4310c0, 0x0, 0x0, 0x0)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/network.go:477 +0x1c0
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.(*Allocator).doNetworkInit(0xc44dfc62c0, 0x55fea0e85a80, 0xc42c4310c0, 0x0, 0x0)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/network.go:154 +0x4da
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.(*Allocator).(github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.doNetworkInit)-fm(0x55fea0e85a80, 0xc42c4310c0, 0xc, 0xc)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go:105 +0x40
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.(*Allocator).init(0xc44dfc62c0, 0x55fea0e85a80, 0xc42c4310c0, 0xc43af797e0, 0x0, 0x0, 0xc44dfb8610, 0x0)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go:174 +0x4dd
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.(*Allocator).Run.func2(0x0, 0x0)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go:122 +0xbc
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator.(*Allocator).Run(0xc44dfc62c0, 0x55fea0e85a80, 0xc4209dcd80, 0x0, 0x0)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/allocator/allocator.go:142 +0x4e1
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: github.com/docker/docker/vendor/github.com/docker/swarmkit/manager.(*Manager).becomeLeader.func6(0x55fea0e85a80, 0xc4209dcd80, 0xc44dfc62c0)
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/manager.go:1048 +0x45
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]: created by github.com/docker/docker/vendor/github.com/docker/swarmkit/manager.(*Manager).becomeLeader
May 15 17:35:42 ubuntu-18-04-template.host.com dockerd[2786]:         /go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/manager.go:1047 +0xf34
May 15 17:35:42 ubuntu-18-04-template.host.com systemd[1]: docker.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 15 17:35:42 ubuntu-18-04-template.host.com systemd[1]: docker.service: Failed with result 'exit-code'.
May 15 17:35:42 ubuntu-18-04-template.host.com systemd[1]: Failed to start Docker Application Container Engine.
May 15 17:35:44 ubuntu-18-04-template.host.com systemd[1]: docker.service: Service hold-off time over, scheduling restart.
May 15 17:35:44 ubuntu-18-04-template.host.com systemd[1]: docker.service: Scheduled restart job, restart counter is at 2.
May 15 17:35:44 ubuntu-18-04-template.host.com systemd[1]: Stopped Docker Application Container Engine.
May 15 17:35:44 ubuntu-18-04-template.host.com systemd[1]: Closed Docker Socket for the API.
May 15 17:35:44 ubuntu-18-04-template.host.com systemd[1]: Stopping Docker Socket for the API.```
moby/moby

Answer questions dperny

me_irl: https://www.youtube.com/watch?v=bLHL75H_VEM

useful!

Related questions

Swarm restarts all containers hot 2
integration: "error reading the kernel parameter" errors during CI hot 2
can not successfully install docker-ce on ubuntu 16.04 ? why ,Can you help me? hot 1
OCI runtime exec failed: exec failed: cannot exec a container that has stopped: unknown hot 1
Allow COPY command's --chown to be dynamically populated via ENV or ARG hot 1
windowsRS1 and windowsRS5-process are failing due to "Unable to delete '\gopath\src\github.com\docker\docker" hot 1
Error response from daemon: rpc error: code = DeadlineExceeded desc = context deadline exceeded hot 1
one container in the overlay network not available hot 1
Containers on overlay network cannot reach other containers hot 1
"initgroups, operation not permitted" error in apache2-mpm-itk when inside Docker - moby hot 1
[Windows] windowsfilter folder impossible to delete hot 1
swarm node lost leader status hot 1
New-SmbGlobalMapping don't continued working in Container hot 1
failed to export image: failed to create image: failed to get layer: layer does not exist hot 1
"docker stack deploy">"rpc error: code = 3 desc = name must be valid as a DNS name component" hot 1
Github User Rank List