Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker expose uses TCP for all ports, but 8125 needs UDP #12

Open
lsalvadorini-c4w opened this issue Jan 10, 2017 · 2 comments
Open

Docker expose uses TCP for all ports, but 8125 needs UDP #12

lsalvadorini-c4w opened this issue Jan 10, 2017 · 2 comments

Comments

@lsalvadorini-c4w
Copy link

I've installed the plugin and tryed to expose the port of StatsD to use it from a non containerized app on another host.

The ambassador container starts correctly but expose the 8125 port using TCP and not UDP, is it possibile to have StatsD port exposed as UDP?

@matteing
Copy link

matteing commented Jul 3, 2020

Bump - also facing this issue. Can't access StatsD externally due to this, resorted to a bit of a hack messing with docker.

EDIT: The fix would probably be by modifying this line to do this.

I'd do a push request but my bash skills are practically nonexistent. :P

@matteing
Copy link

matteing commented Jul 3, 2020

UPDATE: I found a temporary workaround to the problem, although it's quite involved.

  1. Unexpose the Graphite ports.
  2. Expose them, but set the StatsD port to a different port than usual. In my case, I set it to 8120.
  3. Get the Docker internal IP for the non-ambassador Graphite docker instance.
  4. Set up a socat pipe to redirect the UDP traffic to the Docker Graphite instance.
# Get the IP for the non-ambassador Docker container
sudo docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a
# Inspect that container, find its IP 
sudo docker inspect c28099211a37 | grep IPAddress
# Setup a socat proxy to redirect UDP traffic from 8125 on the host to 8125 on non-ambassador Graphite
sudo docker run -d --rm -p 8125:1234/udp verb/socat:alpine -d -d UDP4-LISTEN:1234,reuseaddr,fork UDP4:172.17.0.6:8125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants