An image aimed at being a very simple way of broadcasting mDNS information on a local network
1.2K
This image aims to be a very simple way of broadcasting mDNS information on a local network. Since docker does not broadcast the service name of services or containers to the local network, the motivation behind this was to allow users to broadcast where docker services are on their network with very little effort or setup.
The image is build using python:3.8-alpine as its base for space, but this can be changed to anything desired. Simply, the container runs a single python script which uses python-zeroconf to broadcast mDNS service information to a local network.
Download the repo into a know location:
git clone https://github.com/thebigpotatoe/Docker-mDNS.git
To build the container from this repo simply run:
/bin/sh scripts/build.sh
Then run a custom service using this image on the current host machine. An example to publish where portianer is hosted is as follows:
docker run \
--network host \
--env mdns_service_name=portainer \
--env mdns_port=9000 \
docker-mdns
Each container is designed to broadcast and respond to one mDNS service only. Simply spawn more than one container to publish more than one service. Services are customised through environmental variables at run time, each are optional but allow users to customise their setup. These environmental variables can be input via the command line when running a docker. Please see the docker documentation for more info. A complete list is:
80)_http._tcp.local.)None)The container also needs to be run on the host network using --network host to both obtain the correct IP to broadcast automatically and to be able to respond to mDNS packets
To supply the mDNS service with text entries, you may supply a single level JSON object as a string to be parsed. For example adding a text entry to state weather the service is production or development is as easy as:
docker run \
--network host \
--env mdns_text_services={\"production\":false} \
docker-mdns
This image isn't perfect, so if there is anything the can be optised, pull requests are most welcome :smile:
Content type
Image
Digest
Size
27.8 MB
Last updated
about 6 years ago
docker pull thebigpotatoe/docker-mdns