This script allows to register any *.local hostname using Zeroconf.
Under the hood it uses python-zeroconf library to announce "fake" services
with given hostnames. This approach allows to add new hostnames without modifying hosts
file.
Note: Windows can resolve hostnames even if ".local" top level domain isn't specified.
The main purpose of the script is to connect to Docker containers by hostname from applications on the host OS.
The script can collect hostnames from docker-compose.yml
files.
Note: You also need to map ports to be able to actually connect to your container.
Configuration is read from config.yml
file:
interface
(string) - specifies which interface to use to announce services (hostnames). By default WSL2 interface is used.docker-compose-paths
(list) - docker-compose files to collect hostnames from. Docker service names are registered along with names incontainer_name
andhostname
fields if specified.hostnames
(list) - list of hostnames to register.