服务器重启之后,sudo docker -ps 报错:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

在网上找了很多方法,然并软,最后在同学的提醒之下,查看了官方文档,才有所顿悟,demean , 即需要先启动 deamon 监控

sudo dockerd
启动日志如下:

(venv2) linlf@ccrfox246:~$ sudo dockerd
INFO[2018-05-18T11:23:54.854946720+08:00] libcontainerd: started new docker-containerd process  pid=3675
INFO[0000] starting containerd                           module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3
INFO[0000] loading plugin "io.containerd.content.v1.content"...  module=containerd type=io.containerd.content.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.btrfs"...  module=containerd type=io.containerd.snapshotter.v1
WARN[0000] failed to load plugin io.containerd.snapshotter.v1.btrfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module=containerd
INFO[0000] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  module=containerd type=io.containerd.snapshotter.v1
INFO[0000] loading plugin "io.containerd.metadata.v1.bolt"...  module=containerd type=io.containerd.metadata.v1
WARN[0000] could not use snapshotter btrfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" module="containerd/io.containerd.metadata.v1.bolt"
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  module=containerd type=io.containerd.differ.v1
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  module=containerd type=io.containerd.gc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.events"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.healthcheck"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.images"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.monitor.v1.cgroups"...  module=containerd type=io.containerd.monitor.v1
INFO[0000] loading plugin "io.containerd.runtime.v1.linux"...  module=containerd type=io.containerd.runtime.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.version"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.introspection"...  module=containerd type=io.containerd.grpc.v1
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd-debug.sock" module="containerd/debug"
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc"
INFO[0000] containerd successfully booted in 0.078469s   module=containerd
INFO[2018-05-18T11:23:56.961325951+08:00] [graphdriver] using prior storage driver: aufs 
INFO[2018-05-18T11:24:06.980311605+08:00] Graph migration to content-addressability took 0.47 seconds 
WARN[2018-05-18T11:24:06.981337161+08:00] Your kernel does not support swap memory limit 
WARN[2018-05-18T11:24:06.981658119+08:00] Your kernel does not support cgroup rt period 
WARN[2018-05-18T11:24:06.982216710+08:00] Your kernel does not support cgroup rt runtime 
INFO[2018-05-18T11:24:06.983346602+08:00] Loading containers: start.                   
INFO[2018-05-18T11:24:16.733085488+08:00] Removing stale sandbox 83569c3cec0ef414f8af6209f0343c45c3d1a1f9a92fe5cceda0f9839863c573 (1699d0e7bed48f41dfc79ece595304b755d82fd7d0606fdb3a30f77841c9acf8) 
WARN[2018-05-18T11:24:16.852194017+08:00] Error (Unable to complete atomic operation, key modified) deleting object [endpoint be60b3905c9acb5c07e3f1e61456bb19967abe4a14b99c3f33b1815ae9245beb a23a32a34ea917a905e90785be70841df01ef38f668fc3f3953a1cc9746d9552], retrying.... 
INFO[2018-05-18T11:24:17.368562854+08:00] Default bridge (docker0) is assigned with an IP address 172.21.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[2018-05-18T11:24:20.434304113+08:00] Loading containers: done.                    
INFO[2018-05-18T11:24:20.935540986+08:00] Docker daemon                                 commit=9ee9f40 graphdriver(s)=aufs version=18.03.1-ce
INFO[2018-05-18T11:24:20.952068858+08:00] Daemon has completed initialization          
INFO[2018-05-18T11:24:21.001848825+08:00] API listen on /var/run/docker.sock    
之后便可以正常运行 docker 了。记住是服务器(电脑)重启的情况。
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐