Opening Docker to TCP connections
This is the best way i have found to configure docker on my linux boxes to open them up for tcp connections - the tcp connections are used for Portainer to connect to them. I did no do any security, everything is behind a good firewall.
Instructions
The command systemctl edit is used to change the launch parameters of the docker service.
- Edit the docker service
> sudo systemctl edit docker - In the editor, past in the following
Save the file and exit the editor.
[Service] ExecStart= ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 - Restart docker
> sudo systemctl restart docker - Check docker is running with new parameters
> pgrep -a docker 21239 /usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
Configure Portainer
- Login to your portianer instance.
- Click on
Environments. - Click on
+Add Environment. - Choose
DockerforEnvironment Type. - Enter a name for the environment in
NameunderEnvironment Details. - Enter
hostname:2375underEnvironment URL, where hostname is the hostname of the docker instance. - Click
+Add environment.