如何从 Docker 错误非法指令中恢复 Raspberry Pi 3B

How to recover from Docker Error Illegal Instruction on Raspberry Pi 3B

在 Raspbian Buster 上的 Raspberry Pi 3B 上启动容器时,我 运行 遇到以下错误:

docker: Error response from daemon: : signal: illegal instruction (core dumped): unknown.
ERRO[0001] error waiting for container: context canceled

最近我一直在用尽 Raspberry Pi 3B 上的资源(正在考虑升级,但同时我不想停止自托管),所以有时容器会由于缺少资源。

容器在今天早上重新启动时一直运行良好。今天早上我一直收到上述非法指令错误。我拥有的所有容器都会发生这种情况,dockerdocker-compose,甚至在 运行ning docker run hello-world 使用 dockers hello-world 示例容器时也是如此。一周内 运行 没有任何更新,因此新的更新可能不是问题(即 docker-ceraspberrypi-kernal 过去曾引起冲突但很快已解决)。

我试过重新启动、删除和安装 docker-ce、删除所有容器、删除所有网络、删除图像并重新启动 Docker 服务。

当运行使用docker-compose --verbose up -d lidarr之类的东西时,非法指令错误似乎总是在连接到网络时发生。下面是输出的末尾,删除了一些重复:

...
...

compose.cli.verbose_proxy.proxy_callable: docker create_container <- (environment=['PUID=1000', 'PGID=1000', 'TZ=America/New_York'], image='linuxserver/lidarr:latest', ports=[('8686', 'tcp')], volumes={'/music': {}, '/config': {}, '/downloads': {}}, name='pi_lidarr_1', detach=True, labels={'com.docker.compose.project': 'pi', 'com.docker.compose.service': 'lidarr', 'com.docker.compose.oneoff': 'False', 'com.docker.compose.project.working_dir': '/home/pi', 'com.docker.compose.project.config_files': 'docker-compose.yml', 'com.docker.compose.container-number': '1', 'com.docker.compose.version': '1.29.2', 'com.docker.compose.config-hash': '1ee750c8b41eee12fce59c62e06cdf73a46c7177c028d758de86977788a63b1e'}, host_config={'NetworkMode': 'pi_default', 'RestartPolicy': {'Name': 'unless-stopped', 'MaximumRetryCount': 0}, 'VolumesFrom': [], 'Binds': ['/path/to/music:/music:rw', '/path/to/config:/config:rw', '/path/to/downloads:/downloads:rw'], 'PortBindings': {'8686/tcp': [{'HostIp': '', 'HostPort': '8686'}]}, 'Links': [], 'LogConfig': {'Type': '', 'Config': {}}}, networking_config={'EndpointsConfig': {'pi_default': {'Aliases': ['lidarr'], 'IPAMConfig': {}}}})
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
...
...
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.cli.verbose_proxy.proxy_callable: docker create_container -> {'Id': 'c33e4f4808dac0c794f3806176ad73cafddf10a7088e62181fcf79065db6cb4f',
 'Warnings': []}
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('c33e4f4808dac0c794f3806176ad73cafddf10a7088e62181fcf79065db6cb4f')
compose.parallel.feed_queue: Pending: set()
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': [],
 'Config': {'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': None,
            'Domainname': '',
            'Entrypoint': ['/init'],
            'Env': ['PUID=1000',
                    'PGID=1000',
...
compose.cli.verbose_proxy.proxy_callable: docker disconnect_container_from_network <- ('c33e4f4808dac0c794f3806176ad73cafddf10a7088e62181fcf79065db6cb4f', 'pi_default')
compose.parallel.feed_queue: Pending: set()
compose.cli.verbose_proxy.proxy_callable: docker disconnect_container_from_network -> None
compose.cli.verbose_proxy.proxy_callable: docker connect_container_to_network <- ('c33e4f4808dac0c794f3806176ad73cafddf10a7088e62181fcf79065db6cb4f', 'pi_default', aliases=['lidarr', 'c33e4f4808da'], ipv4_address=None, ipv6_address=None, links=[], link_local_ips=None)
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.cli.verbose_proxy.proxy_callable: docker connect_container_to_network -> None
compose.cli.verbose_proxy.proxy_callable: docker start <- ('c33e4f4808dac0c794f3806176ad73cafddf10a7088e62181fcf79065db6cb4f')
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
...
...
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
Creating pi_lidarr_1 ... error
compose.parallel.feed_queue: Pending: set()

ERROR: for pi_lidarr_1  Cannot start service lidarr: : signal: illegal instruction (core dumped): unknown
compose.parallel.parallel_execute_iter: Failed: <Service: lidarr>
compose.parallel.feed_queue: Pending: set()

ERROR: for lidarr  Cannot start service lidarr: : signal: illegal instruction (core dumped): unknown
ERROR: compose.cli.main.exit_with_metrics: Encountered errors while bringing up the project.

对于系统信息,uname -a 输出:

Linux raspberrypi 5.10.63-v7+ #1496 SMP Wed Dec 1 15:58:11 GMT 2021 armv7l GNU/Linux

docker-compose version 输出:

docker-compose version 1.29.2, build unknown
docker-py version: 5.0.0
CPython version: 3.7.3
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

docker --version 输出:

Docker version 20.10.12, build e91ed57

docker info 显示:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.7.1-docker)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 7
 Server Version: 20.10.12
 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: 1
 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: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.63-v7+
 Operating System: Raspbian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: armv7l
 CPUs: 4
 Total Memory: 923.2MiB
 Name: raspberrypi
 ID: EHO6:EVEP:2WCL:G5HM:S4TO:BOFX:WXTM:GXBA:X5Z6:6YYI:YVMW:QGEZ
 Docker Root Dir: /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 memory limit support
WARNING: No swap limit support
WARNING: No kernel memory TCP limit support
WARNING: No oom kill disable support
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

“导致”非法指令错误的容器,仅举几例:

更新:我在尝试 docker run hello-world 后检查了 Journalctl 中的 docker 条目并发现:

Feb 26 13:08:25 raspberrypi dockerd[4602]: time="2022-02-26T13:08:25.253390090-05:00" level=error msg="stream copy error: reading from a closed fifo"
Feb 26 13:08:25 raspberrypi dockerd[4602]: time="2022-02-26T13:08:25.253526860-05:00" level=error msg="stream copy error: reading from a closed fifo"
Feb 26 13:08:26 raspberrypi dockerd[4602]: time="2022-02-26T13:08:26.084248757-05:00" level=error msg="2caf65051f4e40260e125c398541db0969a57ff8544c4ae9010c3e859f43ba25 cleanup: failed to delete container from containerd: no such container"
Feb 26 13:08:26 raspberrypi dockerd[4602]: time="2022-02-26T13:08:26.084429642-05:00" level=error msg="Handler for POST /v1.41/containers/2caf65051f4e40260e125c398541db0969a57ff8544c4ae9010c3e859f43ba25/start returned error: : signal: illegal instruction (core dumped): unknown"

有谁知道如何诊断 and/or 从中恢复?

我能够解决这个问题,不幸的是我无法找出发生这种情况的原因。

我尝试再次删除和安装 docker-ce 和依赖项。由于 containerd.service 没有停止,我无法删除。我发现它被设置为总是重新启动,这通常是有道理的。然后我 运行 sudo systemctl disable docker containerd 并重新启动。我通过跟踪 journalctl 输出确认这些服务不再是 运行,寻找来自 dockercontainerd.

的常见重启和 core-dump 错误

我再次 运行 sudo apt remove docker-cesudo apt autoremove,然后 运行 docker 的 get-docker.sh 重新安装了 docker。我然后 运行 sudo systemctl enable docker containerdsudo systemctl start docker containerd。 Docker 与之前的版本相同,hello-world 容器和我以前 运行 没有的其他容器现在 运行 成功。