Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
  2. Add /etc/systemd/system/docker.service.d/override.conf

     [Service]
     ExecStart=
     ExecStart=/usr/bin/dockerd
    
  3. Reload the systemd daemon:

     systemctl daemon-reload
    
  4. Restart docker:

     systemctl restart docker.service
    
@vincentgerris
Copy link

vincentgerris commented Jan 24, 2022

check logs, journalctl -xe. The options overlap, remove the 127.0.0.1 , 0.0.0.0 means all interfaces.

@h4r5h1t-hrs
Copy link

h4r5h1t-hrs commented Jan 28, 2022

Follow this:
https://docs.docker.com/engine/install/linux-postinstall/#configure-where-the-docker-daemon-listens-for-connections

NOTE: Just change the IP from 127.0.0.1 to 0.0.0.0 and its work fine for Ubuntu ( for selenium dynamic grid)

@smblott-github
Copy link

smblott-github commented Feb 1, 2022

I found that the docker daemon failed to start on reboot (only) with the approach described here. I never tracked down the source of the problem.

However, it did lead me to implement instead an alternative solution with socat:

exec socat -d TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock

Notes:

  • I used daemontools to launch this an keep it running (https://cr.yp.to/daemontools.html).
  • You can protect the port with the range=... option to socat, or with IP tables or netfilter.

@Nakilon
Copy link

Nakilon commented Apr 20, 2022

Does not work for Docker Desktop on Windows. It refuses bind to 0.0.0.0

@rcedillo45
Copy link

rcedillo45 commented Apr 27, 2022

I was having an issue to connect from another machine, turns out it was a firewall issue.
to fix I did:
ufw allow 2375/tcp
ufw reload
hopefully this helps someone.

@russellhoff
Copy link

russellhoff commented May 12, 2022

Thanks!!

@sithson
Copy link

sithson commented May 19, 2022

👍 ✔️ 🙇‍♀️
I can also confirm this, very much GG @styblope, my rock star hero!1 :))))))

Specs:

  • Linux Mint 20.3 Una x64
  • Docker version 20.10.16, build aa7e414
  • Docker Compose version v2.5.0

@sumitdhungana14
Copy link

sumitdhungana14 commented Aug 4, 2022

🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment