{"id":13586561,"url":"https://github.com/zanaca/docker-dns","last_synced_at":"2026-01-16T05:49:37.204Z","repository":{"id":23902441,"uuid":"99924138","full_name":"zanaca/docker-dns","owner":"zanaca","description":"DNS server for your docker containers. Allowing you to access them with a domain name, without exposing ANY port. Allowing access from you linux, mac or windows browser!","archived":false,"fork":false,"pushed_at":"2022-08-30T15:02:58.000Z","size":1600,"stargazers_count":82,"open_issues_count":1,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-02-14T21:30:15.296Z","etag":null,"topics":["dns","docker","docker-containers","hyperkit","linux","macos","networking","routing","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zanaca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-10T13:07:49.000Z","updated_at":"2024-01-13T10:26:12.000Z","dependencies_parsed_at":"2023-01-14T08:30:10.285Z","dependency_job_id":null,"html_url":"https://github.com/zanaca/docker-dns","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanaca%2Fdocker-dns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanaca%2Fdocker-dns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanaca%2Fdocker-dns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanaca%2Fdocker-dns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zanaca","download_url":"https://codeload.github.com/zanaca/docker-dns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247707691,"owners_count":20982828,"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":["dns","docker","docker-containers","hyperkit","linux","macos","networking","routing","windows"],"created_at":"2024-08-01T15:05:39.217Z","updated_at":"2026-01-16T05:49:37.181Z","avatar_url":"https://github.com/zanaca.png","language":"Python","readme":"# Docker DNS for containers and host machine\n\nDocker DNS creates a container that works as a DNS for docker containers in you machine. Every running container will be accessible by `$container_name.docker` for example. You could inform you own domain if you like. Your domains are available _inside_ and _outside_ docker, but just for you machine. For example, you could access *http://nginx.docker* from your browser window OR from inside a container.\n\nIt was created to allow you to work in a container as if was a \"real\" server setup. You will have access to all ports/services inside the container without need to expose all the ports. You can publish ports as well to access it like the old way. E.g.: 127.0.0.1:8080 -\u003e container_ip:80\n\nIt was tested on linux and macOS Catalina. macOS environment has a downside that you will always run the `./bin/docker-dns tunnel` every time you boot the host machine. An service will be installed and loaded on every boot to handle that necessity or you can run the application 'dockerdns-tunnel', available on `~/Applications`.\n\nThe main usage is for development environment only, should not be used in production environment.\n\nBy default it will enable create that hosts: _ns0.docker_ and _ns0.\\$YOUR_HOSTNAME.docker_.\n\n## Requirements for host machine\n\n-   [Docker](https://www.docker.com/products/docker-desktop)\n-   Python3\n-   pip\n-   OpenSSH\n\n## Tested enviroment\n\n-   Docker 19.03.13\n-   Ubuntu: 20.04\n-   Linux Mint: 20, 20.1\n-   macOS: Catalina, Big Sur\n-   Windows: 10 (WSL2 - Ubuntu)\n\nYou can see a list of older OSes on version [1.x](https://www.github.com/zanaca/docker-dns/blob/version/1.x/README.md#tested-enviroment)\n\nOn Windows you don't have to install Docker inside WSL2 linux, you should work with Docker for windows and enable WSL2 integration.\n\n#### \\* _Windows caveat_\n\nFor Windows a socks5 proxy (using ssh to container ns0) will be used to handle the address from host machine to docker network.  Only addresses from `172.16.0.0` to `172.31.255.255` will be redirect to proxy. You will not be able to run a different proxy while using `docker-dns`. The socks5 proxy address is `127.0.0.1` using port `31080`\n\n## Install\n\nFor an simple installation process, paste the command in a macOS Terminal, Linux or WSL shell prompt.\n\n```\n$ /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/zanaca/docker-dns/install/run.sh)\"\n```\n\n-   The script will place docker-dns inside `/usr/local/docker-dns`\n\nOr you can checkout the code in any folder of your choice and:\n\n-   Install all python dependencies by running `$ pip3 install -r requirements.txt`\n-   Execute `$ ./bin/docker-dns install`\n\n## Supported commands\n\n-   `install` - Set up all environment;\n\n-   `uninstall` - Remove configuration files from your system;\n\n-   `show-domain` - Show the working domain of your installation;\n\n-   `tunnel` - Create a tunnel to route all traffic to you docker containers. Available only in macOS, on linux you don't need that feature;\n\n-   `status` - Show the current status for your machine.\n\nYou can see the list of all available commands and options running `$ ./bin/docker-dns -h`\n\n## Options\n\nOn `install` command you can pass some variables to change how setup is done. You can change the working domain for example.\n\n-   _tld_: working domain. It can be any domain name but the domains designed to work in loopback network. For example `yourmachine.dev` will create names like `CONTAINER_NAME.yourmachine.dev`. You can have `docker.your_real_domain.com` as well so it will create names like `CONTAINER_NAME.docker.your_real_domain.com . Default value: `docker`;\n\n-   _tag_: Tag name for the created docker image. It should be changed only if you have a name conflict Default value: `ns0`;\n\n-   _name_: Running container name. Default value: the _tag_ value.\n\nExample:\n```\n$ ./bin/docker-dns install tld=docker.dev tag=dns\n```\n\nWill create a docker image name _dns_ and it will be available as _dns.docker.dev_ so you could run `dig www.google.com @dns.docker.dev`\n\n## Troubleshooting\n\nIf you are using macOS or Windows, on restart, you can will loose access to your containers DNS. You need to recreate a tunnel to route all traffic to docker network through it on every boot. Just execute `sudo ./bin/docker-dns tunnel` from docker-dns folder\n\n## License\n\n[MIT](LICENSE.md)\n\n## Thanks\n\n-   Thanks to https://github.com/apenwarr/sshuttle for the great poor's man VPN service! An easy way to setup tunneling on macOS and Windows WSL\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzanaca%2Fdocker-dns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzanaca%2Fdocker-dns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzanaca%2Fdocker-dns/lists"}