So the main problem I’m trying to solve is that every 5 seconds, docker health-check triggers unwanted log entries from systemd like
Dec 26 15:39:47 vivy systemd[1]: run-docker-runtime\x2drunc-moby-7bedfdc72f129af011664c1a65fe5c975f130354dac2c968dd254fd33000723d-runc.iHLI5U.mount: Deactivated successfully.
Googling leads to this issue https://github.com/systemd/systemd/issues/6432
TLDR: Systemd has no way of filtering, which is being requested. As a workaround, we can set LogLevelMax=0 for a prefix of the mount unit.
But, what I want is that the final effect must be creating a directory “/etc/systemd/system/run-docker-.mount.d” containing a file ending with “.conf” containing above content.
I see that there are multiple service.d directories
[root@vivy:~]# ls -ld /etc/systemd/system/*.service.d
dr-xr-xr-x 2 root root 4096 Jan 1 1970 /etc/systemd/system/autovt@.service.d
dr-xr-xr-x 2 root root 4096 Jan 1 1970 /etc/systemd/system/container-getty@.service.d
dr-xr-xr-x 2 root root 4096 Jan 1 1970 /etc/systemd/system/dbus.service.d
...
Another solution is creating a custom systemd package, adding the mount.d directory with my own .conf file into the package itself. I believe this might be the cleanest way.
Q2: Is this the best way?
The goal here is just to create a template directory for all run-docker- units, and not define a real mount unit. The path “run/docker” is meaningless. I chose that because it results in a mount unit called run-docker-.mount, which is the closest I could get to a directory called “run-docker-.mount” inside /etc/systemd/system.