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

関連情報