Connect Portainer to remote docker instance

I run several services via docker on different devices. I wanted to manage all these docker instances via one Portainer docker instance.

The connection to the local docker instance on 192.168.1.100 is done using Unix socket following this documentation

The connection to the remote docker instances on 192.168.1.101 & 192.168.1.102 is configured following this documentation

For remote instance you need to replace 127.0.0.1 by the correct IP address of your remote servers: 192.168.1.101 & 192.168.1.102 in this example

Use the command sudo systemctl edit docker.service to open an override file for docker.service in a text editor.

Add or modify the following lines, substituting your own values.

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://192.168.1.101:2375

Save the file.

Reload the systemctl configuration.

 sudo systemctl daemon-reload

Restart Docker.

 sudo systemctl restart docker.service

Once done you can add this docker instance as a new environment in your portainer:

This solution is good only for a private use, in a professional environment you would prefer to connect via a secured connection using TLS certificates.

Leave a Reply

Your email address will not be published.