TLDR
To have watchtower monitor a remote Docker endpoint you first need to enable TCP port 2375 for external connection.
Remote Host
On the remote host, follow these steps:
- Run
vi /etc/docker/daemon.json
and paste:
1
{"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
- Run
systemctl edit docker.service
and paste lines 4-6:
1
2
3
4
5
6
7
8
### Editing /etc/systemd/system/docker.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
### Lines below this comment will be discarded
- Reload the systemd daemon and restart docker:
1
2
systemctl daemon-reload
systemctl restart docker.service
Local Host
On the local host, simply run the watchtower container and specify the remote host:
1
2
3
4
docker run -d \
--name watchtower \
-e DOCKER_HOST="tcp://10.0.1.2:2375" \
containrrr/watchtower
Summary
I had to dig for this on my own as the watchtower documentation just shows the last command. On their page it doesn’t mention at all about enabling the port. In hindsight, I guess it does make sense.