Directly Connect to the Docker API Remotely

I am trying to get Portainer to connect to the API on a remote host and am not having any luck. Portainer is running on a docker host and connects to the local Docker API without issue. If I add a new endpoint, select “Directly Connect to the Docker API”, enter 192.168.1.100:2375 for endpoint URL, and click add endpoint, I get the following error:

“Failure Get http://192.168.1.103:2375/_ping: dial tcp 192.168.1.103:2375:connect: connection refused”

I do have “Expose daemon on tcp://localhost:2375 without TLS” enabled on the remote host and I did restart Docker after enabling.

Does anyone know if this feature is working or if there are additional steps required to make it work?

From the host Portainer is running on try and issue the command docker -H 192.168.1.103:2375 info if this doesn’t work then TCP access is not working from the host.

You can refer to this issue and this thread for troubleshooting advice

You are correct. Running that command confirms the Docker API is not responding on the LAN IP address. It works fine with localhost or 127.0.0.1.

Following the Docker docs, I tried adding several variation of “hosts”: [“tcp://192.168.1.103:2375”] to daemon.json, but Docker then fails to load. Guessing this is another networking feature only supported on Docker Linux hosts.

I also found some other references about creating a local environmental variable for DOCKER_HOST, but no clear direction on how to use it. Even the Docker documentation mentions it, but does not give an example of the exact syntax needed to use it in config.json.

Not sure this will work with Windows Docker hosts.

Try tcp://docker.for.win.localhost:2375

See this discussion for more info.