Docker Community Forums

Share and learn in the Docker community.

UDP port mappings broken for all but localhost?


(R. Toma) #1

Expected behavior

Run an UDP listener inside of a container with port map 8125:8125/udp.
(I am using “socat UDP-LISTEN:8125,fork -” for the listener. See dockerfile below.)

Send data to UDP port 8125 on the host, socat receives it and prints it.
(I am “date | nc -u 8125” to send data.)

Actual behavior

works: date | nc -u 127.0.0.1 8125
works: date | nc -u localhost 8125
works: date | nc -u ::1 8125

does not work: date | nc -u $(ipconfig getifaddr en0) 8125
(the IP of en0 is 192.168.27.107, see ifconfig output below)

Information

  • the output of:
    • Moby Menu > Diagnose & Feedback on OSX
Docker for Mac: version: mac-v1.12.0-beta16.2
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/20160622-113604.tar.gz
failure: No error was detected
[OK]     docker-cli
[OK]     app
[OK]     menubar
[OK]     virtualization
[OK]     system
[OK]     osxfs
[OK]     db
[OK]     slirp
[OK]     moby-console
[OK]     logs
[OK]     vmnetd
[OK]     env
[OK]     moby
[OK]     driver.amd64-linux

  • a reproducible case if this is a bug, Dockerfiles FTW
FROM alpine:3.4
RUN apk add --update socat && rm -rf /var/cache/apk/*
ENTRYPOINT ["socat"]
  • page URL if this is a docs issue or the name of a man page
  • host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )

this is my en0 config:

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 6c:40:08:90:60:9a
	inet6 fe80::6e40:8ff:fe90:609a%en0 prefixlen 64 scopeid 0x5
	inet 192.168.27.107 netmask 0xffffff00 broadcast 192.168.27.255
	nd6 options=1<PERFORMNUD>
	media: autoselect
	status: active

output of ‘docker ps’:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
a7e5aba885fa        rtoma/socat         "socat UDP-LISTEN:812"   3 seconds ago       Up 2 seconds        0.0.0.0:8125->8125/udp   naughty_noyce

Steps to reproduce the behavior

  1. run socat in container, with udp port mapped
  2. send data to that udp port

External hosts not reachable over UDP with hostnet