我有安装了最新 docker_compose 的 Ubuntu 20.04 VM,上次 VM 更新并重新启动后,所有 docker 的数据都丢失了。
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker ps -all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
~$ docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.0-docker)
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 19.03.11
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 ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc version:
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-58-generic
Operating System: Ubuntu Core 16
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 2.922GiB
Name: ubuntu-vm
ID: 672D:62WJ:EI7V:KCSA:CO4S:UMZG:MHOR:LA3D:UIYJ:J7OZ:G4ID:PYED
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
我不确定,但数据目录是否由于最新更新而发生变化?我注意到 Docker Root Dir:现在是 /var/snap/docker/common/var-lib-docker - 不确定之前是什么...
$ sudo du -hs /var/snap/docker/common/var-lib-docker
644K /var/snap/docker/common/var-lib-docker
这个目录几乎是空的(644K),而不是旧的(7.5G)/var/lib/docker/ 目录
~$ sudo du -hs /var/lib/docker/
du: cannot access '/var/lib/docker/overlay2/407d225866adecc74197895905e4bb690e13c2266257ce97c2eb633b38f8b0b4-init': No such file or directory
du: cannot access '/var/lib/docker/overlay2/3b2c4e3d15bcedc8a98a369b2d43fd8b3640ee885b486ba7cce9ad527152f07b': No such file or directory
du: cannot access '/var/lib/docker/overlay2/3b2c4e3d15bcedc8a98a369b2d43fd8b3640ee885b486ba7cce9ad527152f07b-init': No such file or directory
du: cannot access '/var/lib/docker/overlay2/407d225866adecc74197895905e4bb690e13c2266257ce97c2eb633b38f8b0b4': No such file or directory
7.5G /var/lib/docker/
我尝试停止 docker 服务并用 /var/lib/docker/ 中的数据替换 /var/snap/docker/common/var-lib-docker/ 的内容,但结果是 docker ps -all 和其他命令都返回相同的空响应
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2bb80650b7ee bf756fb1ae65 "/hello" 2 hours ago Exited (0) 2 hours ago great_germain
docker_compose 重新安装后我有这个 /hello 图像(Ubuntu 20.04 中的 Docker 问题),其他人都去哪了?
~$ docker version
Client: Docker Engine - Community
Version: 20.10.1
API version: 1.40
Go version: go1.13.15
Git commit: 831ebea
Built: Tue Dec 15 04:34:58 2020
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 19.03.11
API version: 1.40 (minimum version 1.12)
Go version: go1.13.12
Git commit: 77e06fd
Built: Mon Jun 8 20:24:59 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit:
docker-init:
Version: 0.18.0
GitCommit: fec3683
这里是错误日志:
~$ journalctl -fu docker
Dec 24 23:55:18 ubuntu-vm dockerd[967363]: time="2020-12-24T23:55:18Z" level=info msg="Firewalld: docker zone already exists, returning"
Dec 24 23:55:19 ubuntu-vm dockerd[965644]: time="2020-12-24T23:55:19.666542395Z" level=info msg="ignoring event" container=b2ce232b32e6f222a9708dcb0cb42436c8e39ed2f42c3b0e41788b60464ef94e module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Dec 24 23:55:19 ubuntu-vm dockerd[967407]: time="2020-12-24T23:55:19Z" level=info msg="Firewalld: docker zone already exists, returning"
Dec 24 23:55:20 ubuntu-vm dockerd[967430]: time="2020-12-24T23:55:20Z" level=info msg="Firewalld: docker zone already exists, returning"
Dec 24 23:55:21 ubuntu-vm dockerd[965644]: time="2020-12-24T23:55:21.948192301Z" level=error msg="fatal task error" error="task: non-zero exit (1)" module=node/agent/taskmanager node.id=rzo0jf8l0didecmsq81fbtfho service.id=k8l1kf98uz1gmg7ikb7fahlqy task.id=bve3fgzk41viovoqsw3j257ak
Dec 24 23:55:22 ubuntu-vm dockerd[965644]: time="2020-12-24T23:55:22.310344889Z" level=warning msg="failed to deactivate service binding for container portainer_agent.rzo0jf8l0didecmsq81fbtfho.ulqtkmouxn7edqts3bbl2udde" error="No such container: portainer_agent.rzo0jf8l0didecmsq81fbtfho.ulqtkmouxn7edqts3bbl2udde" module=node/agent node.id=rzo0jf8l0didecmsq81fbtfho
如何将容器数据恢复到以前的状态并摆脱此错误:level=error msg="fatal task error" error="task: non-zero exit (1)" module=node/agent/taskmanager?