You are not logged in.

#1 2022-06-28 14:21:46

henriq20
Member
Registered: 2022-06-27
Posts: 2

Stop Docker before unmounting SSD on shutdown

Every time I reboot or shut down my computer, I get this error:

[FAILED] Failed unmounting /run/media/SSD.

I keep Docker's data under /run/media/SSD/docker. The problem seems to be that the docker service is not stopped until /run/media/SSD is unmounted.

When I run sudo systemctl stop docker before shutting down, I don't get that error. So I'm sure it has to do with docker's not being stopped in time.

How do I stop docker just before my SSD is unmounted?

Offline

#2 2022-06-30 02:09:42

jonno2002
Member
Registered: 2016-11-21
Posts: 868

Re: Stop Docker before unmounting SSD on shutdown

find your mount target for "/run/meda/SSD" using:

systemctl list-units |grep /run/media/SSD

will be somthing like 'run-media-SSD.mount'

then create a drop in file for docker.service

systemctl edit docker.service

and add the .mount target to After and BindsTo

should look somthing like this:

### Editing /etc/systemd/system/docker.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file

BindsTo=run-media-SSD.mount
After=network-online.target docker.socket firewalld.service run-media-SSD.mount

### Lines below this comment will be discarded
...........

then reload systemd daemon:

systemd daemon-reload

and that SHOULD work, i havent tested it tho

Offline

#3 2022-06-30 18:52:39

henriq20
Member
Registered: 2022-06-27
Posts: 2

Re: Stop Docker before unmounting SSD on shutdown

It worked!! Thank you so much smile

My drop-in file:

[Unit]
BindsTo=run-media-henriq-SSD.mount
After=network-online.target docker.socket firewalld.service run-media-henriq-SSD.mount

Offline

Board footer

Powered by FluxBB