{"id":21269578,"url":"https://github.com/fardjad/docker-network-exposer","last_synced_at":"2025-07-11T05:31:05.322Z","repository":{"id":40292689,"uuid":"199059924","full_name":"fardjad/docker-network-exposer","owner":"fardjad","description":"Reach docker containers from the host machine on macOS and Windows where the bridge interface is not available","archived":false,"fork":false,"pushed_at":"2023-01-04T05:27:41.000Z","size":804,"stargazers_count":8,"open_issues_count":15,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-06T02:57:24.063Z","etag":null,"topics":["dnsmasq","docker","docker-bridge-network","docker-compose","docker-for-mac","docker-for-windows","openvpn"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fardjad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-26T18:00:31.000Z","updated_at":"2020-11-23T16:16:57.000Z","dependencies_parsed_at":"2023-02-01T23:15:50.656Z","dependency_job_id":null,"html_url":"https://github.com/fardjad/docker-network-exposer","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardjad%2Fdocker-network-exposer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardjad%2Fdocker-network-exposer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardjad%2Fdocker-network-exposer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardjad%2Fdocker-network-exposer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fardjad","download_url":"https://codeload.github.com/fardjad/docker-network-exposer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225693755,"owners_count":17509227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dnsmasq","docker","docker-bridge-network","docker-compose","docker-for-mac","docker-for-windows","openvpn"],"created_at":"2024-11-21T08:09:02.222Z","updated_at":"2024-11-21T08:09:02.783Z","avatar_url":"https://github.com/fardjad.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Network Exposer\n\n## Motivation\n\nUsing Docker on a non-Linux host has its own shortcomings. Due to the way\nnetworking is implmeneted in Docker for [Mac][1]/[Windows][2], no bridge\ninterface is created on the host. That makes it impossible to access\ncontainers in a user-defined bridge from the host machine (as one would do in\nLinux) without exposing containers' ports.\n\nDocker Network Exposer (DNE) aims to boost developers' productivity by doing\nthe following:\n\n1. Running an [OpenVPN][3] server that makes it possible to seamlessly access\n   a Docker network from the host machine.\n2. Generating an [additional hosts file][4] that can be used by [Dnsmasq][5]\n   to resolve Docker container names on the host machine.\n\n## Requriements\n\n1. Docker 18.06.0+ with docker-compose 1.22.0+\n2. An OpenVPN client (such as [Tunnelblick][5] or the official [client][6])\n3. [Dnsmasq][7] 2.48+\n\n## Usage\n\nAdd the following service definition to your `docker-compose.yml`:\n\n    dne:\n      image: fardjad/docker-network-exposer\n      init: true\n      volumes:\n        - /var/run/docker.sock:/var/run/docker.sock:ro\n        - /path/to/store/openvpn/client-config:/etc/openvpn/client-config\n        - /path/to/store/dnsmasq/addn-hosts:/opt/docker-network-hosts/addn-hosts\n      cap_add:\n        - NET_ADMIN\n      ports:\n        - '1194:1194'\n\nAnd adjust volume mappings for the following directories:\n\n1. `/etc/openvpn/client-config`:\n\n    DNE will generate an OpenVPN client config in this directory. The\n    generated config should be imported into the OpenVPN client software.\n\n2. `/opt/docker-network-hosts/addn-hosts`:\n\n    A [hosts file][8] will be written to this directory and gets removed once\n    DNE container is (gracefully) stopped. One can optionally run a Dnsmasq\n    server on the host machine, configure it to forward queries to some\n    upstream servers, instruct it to use the additional hosts files in the\n    abovementioned directory, and finally configure the host machine to\n    resolve DNS queries through Dnsmasq (a minimal example config can be\n    found [here][9]).\n\n    **NOTE:** Dnsmasq service needs to receive a **SIGHUP** signal in order to\n    reload the settings.\n\nOnce Dnsmasq is configured and the host machine is connected to the VPN,\ncontainers on the same Docker network as DNE will be accessible by their\n*names*, *ids* and *aliases*.\n\n## Environment Variables\n\nWhen exposing more than one Docker network at once, you'll most likely want to \noverride the following environment variables:\n\n1. **OVPN_NETWORK_CIDR**: This variable defaults to `10.8.0.0/24` and specifies \nthe OpenVPN subnet to draw client addresses from. A different subnet must be \nchosen for each Docker network.\n\n2. **OVPN_PORT**: Defaults to `1194` and specifies the port that OpenVPN server \nlistens on. The chosen value will also be used as the port number in the \ngenerated OpenVPN client config file.\n\nA full list of overridable environment variables can be found [here][10].\n\n## Related Projects / Alternatives\n\n* [devdns][100]\n* [dns-proxy-server][101]\n* [docker-tuntap-osx][102]\n* [dory][103]\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n\n[1]: https://docs.docker.com/docker-for-mac/networking/#there-is-no-docker0-bridge-on-macos\n[2]: https://docs.docker.com/docker-for-windows/networking/#there-is-no-docker0-bridge-on-windows\n[3]: https://openvpn.net\n[4]: https://wiki.gentoo.org/wiki/Dnsmasq#Additional_hosts_file\n[5]: https://tunnelblick.net\n[6]: https://openvpn.net\n[7]: http://www.thekelleys.org.uk/dnsmasq/doc.html\n[8]: https://en.wikipedia.org/wiki/Hosts_(file)\n[9]: docs/dnsmasq.conf\n[10]: ovpn-setup/vars.sh\n[100]: https://github.com/ruudud/devdns\n[101]: https://github.com/mageddo/dns-proxy-server\n[102]: https://github.com/AlmirKadric-Published/docker-tuntap-osx\n[103]: https://github.com/FreedomBen/dory\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffardjad%2Fdocker-network-exposer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffardjad%2Fdocker-network-exposer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffardjad%2Fdocker-network-exposer/lists"}