I run several services via docker on different devices. I wanted to manage all these docker instances via one Portainer docker instance.
![](https://www.virtualconfusion.net/wp-content/uploads/2022/03/portainer-2-1024x725.png)
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:
![](https://www.virtualconfusion.net/wp-content/uploads/2022/03/environment.png)
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.