brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: publish UDP ports on Docker with /udp, or DNS and game servers stay silent

Docker
~/tips/tip-docker-publish-udp-port

docker run -d --name dns \

Add /udp to a port mapping for services that speak UDP.

A port mapping without a protocol is TCP only. DNS, WireGuard, game servers and media discovery use UDP, so -p 53:53 publishes the wrong half and the service looks dead from outside.

docker run -d --name dns \
  -p 53:53/tcp -p 53:53/udp \
  example/dns:1.0

DNS needs both: UDP for normal queries and TCP for large answers. In Compose the same suffix works in the list:

ports:
  - "53:53/tcp"
  - "53:53/udp"
  - "51820:51820/udp"

docker compose config shows each entry with its protocol field, which is a quick way to check that you got the UDP ones.

Testing UDP is harder than TCP, which is why this goes unnoticed. A tool like nc -zv reports nothing useful for UDP, because there is no handshake. I would test with the real client instead: dig @203.0.113.10 example.com for DNS, the game client, or wg show on the other end for WireGuard.

On many Linux desktops and servers, something already holds port 53 on the host, often systemd-resolved, so the container fails to start with an address in use error. Free the port first or publish on a specific address.

Further reading: Port publishing and mapping

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link