RPi에서 USB SSD가 준비될 때까지 Docker(docker.service) 시작을 지연하는 방법은 무엇입니까?

RPi에서 USB SSD가 준비될 때까지 Docker(docker.service) 시작을 지연하는 방법은 무엇입니까?

Docker 루트를 마운트된 USB SSD로 옮겼지만 이로 인해 재부팅 시 Docker가 시작되지 않는 것 같습니다.

root@rpi64:~# journalctl -u docker.service -b
-- Journal begins at Sat 2021-10-30 20:46:14 AWST, ends at Thu 2021-12-16 14:01:00 AWST. --
Dec 16 13:39:22 rpi64 systemd[1]: Starting Docker Application Container Engine...
Dec 16 13:39:25 rpi64 dockerd[1038]: time="2021-12-16T13:39:25.010377383+08:00" level=info msg="Starting up"
Dec 16 13:39:25 rpi64 dockerd[1038]: mkdir /var/lib/docker: file exists
Dec 16 13:39:25 rpi64 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Dec 16 13:39:25 rpi64 systemd[1]: docker.service: Failed with result 'exit-code'.
Dec 16 13:39:25 rpi64 systemd[1]: Failed to start Docker Application Container Engine.


root@rpi64:~# journalctl -u containerd -b
-- Journal begins at Sat 2021-10-30 20:46:14 AWST, ends at Thu 2021-12-16 14:03:45 AWST. --
Dec 16 13:39:20 rpi64 systemd[1]: Starting containerd container runtime...
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.752645273+08:00" level=info msg="starting containerd" revision=7b11cfaabd73bb80907dd>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.846710940+08:00" level=info msg="loading plugin \"io.containerd.content.v1.content\">
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.848228792+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.aufs\>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.860678255+08:00" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.860837088+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.btrfs>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.861426995+08:00" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.861515051+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.devma>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.867431810+08:00" level=warning msg="failed to load plugin io.containerd.snapshotter.>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.867552495+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.nativ>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.869033051+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.overl>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.872825736+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.zfs\">
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.873335273+08:00" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.873430995+08:00" level=info msg="loading plugin \"io.containerd.metadata.v1.bolt\"..>
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.873554181+08:00" level=warning msg="could not use snapshotter devmapper in metadata >
Dec 16 13:39:22 rpi64 containerd[579]: time="2021-12-16T13:39:22.873596514+08:00" level=info msg="metadata content store policy set" policy=shared

/lib/systemd/system/docker.service의 "After="에 "local-fs.target"을 추가했지만 문제가 해결되지 않았습니다.

또 무엇을 시도할 수 있나요?

답변1

~에 따르면이 댓글, 나는 다음을 추가했습니다.

After=media-usb.mount media-ssd.mount
Requires=media-usb.mount media-ssd.mount

도착하다:

/lib/systemd/system/docker.service

"유닛 파일"에서:

$ sudo systemctl list-unit-files|grep mount
media-ssd.mount                                                               generated       -
media-usb.mount                                                               generated       -

일치하는 마운트 지점:

$ df -kh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       361G   85G  258G  25% /media/ssd
/dev/sdb1       7.3G  1.3G  5.7G  18% /media/usb

관련 정보