https://github.com/winand/zeroconf-local-hostnames
Resolve any hostname in .local to 127.0.0.1
https://github.com/winand/zeroconf-local-hostnames
dns docker docker-compose hostnames localhost mdns zeroconf
Last synced: 29 days ago
JSON representation
Resolve any hostname in .local to 127.0.0.1
- Host: GitHub
- URL: https://github.com/winand/zeroconf-local-hostnames
- Owner: Winand
- License: mit
- Created: 2023-04-17T19:23:35.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T08:05:29.000Z (almost 3 years ago)
- Last Synced: 2025-03-26T04:34:55.029Z (about 1 year ago)
- Topics: dns, docker, docker-compose, hostnames, localhost, mdns, zeroconf
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Local hostnames for Docker on Windows
This script allows to register any *.local hostname using [Zeroconf](https://en.wikipedia.org/wiki/Zero-configuration_networking).
Under the hood it uses [python-zeroconf](https://github.com/python-zeroconf/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](https://docs.docker.com/compose/compose-file/compose-file-v3/#ports) to be able to actually connect to your container.
## Config
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 in `container_name` and `hostname` fields if specified.
* `hostnames` (list) - list of hostnames to register.