> For the complete documentation index, see [llms.txt](https://strangebutohwell.gitbook.io/knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://strangebutohwell.gitbook.io/knowledge/linux/systemd/delay-docker-until-after-zfs-init.md).

# Delay Docker until after ZFS init

## SystemD standalone service

```bash
[Unit]
Description=Wait for ZFS before starting Docker
RequiredBy=docker.service
Before=docker.service
Requires=zfs.target
After=zfs.target
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
```

## Docker service edit

1. `sudo systemctl edit docker.service`
2. Add the following contents:

{% code title="docker.service" %}

```bash
After=zfs-mount.service 
Requires=zfs-mount.service 
Wants=zfs-mount.service 
BindsTo=zfs-mount.service
```

{% endcode %}
