How to enable the Docker Remote API for Portainer

I use Portainer to manage all of the Docker installations across my home infrastructure. This lets me manage all the containers from a single web interface and makes container administration a breeze.
In order to be able to manage installations that are not on the localhost you need to enable the remote API on your remote machines.
To enable the remote API on a machine we need to create a file to override the defaults. Note that you may need to create the directory .../docker.service.d/... if it doesn't exist already.
Create the file:
/etc/systemd/system/docker.service.d/startup_options.conf
Now copy/paste the content below into the file:
# /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:4243 --containerd=/run/containerd/containerd.sock
Now you can issue a reload of the daemon:
sudo systemctl daemon-reload
and restart the Docker service
sudo systemctl restart docker.service
Done.
You can now manage your remote Docker installation from Portainer!