Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ferranbt/docker-dns-resolution
https://github.com/ferranbt/docker-dns-resolution
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ferranbt/docker-dns-resolution
- Owner: ferranbt
- Created: 2022-11-20T18:20:00.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-20T18:20:25.000Z (almost 2 years ago)
- Last Synced: 2024-06-20T23:52:31.256Z (5 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker custom DNS resolution
This repo describes how to run a custom DNS resolution system for `Docker` containers that does not require any sudo application (outside `Docker` itself).
By default, `Docker` provides a DNS resolution mechanism in which `Docker` containers with the `--name ` flag can be reached by its name from other `Docker` containers. However, this utility only works for simple use cases.
Deploy `coredns` service:
```
$ docker run --name coredns --restart=always --volume=$PWD/coredns/:/root/ coredns/coredns -conf /root/Corefile
```Get the ip of the `Dns` server:
```
$ docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' coredns
172.17.0.2
```Deploy the `Grpc` resolution service:
```
$ go run main.go
```Deploy a `Docker` container connected to the DNS service and make a DNS query:
```
$ docker run --dns 172.17.0.2 -it tutum/dnsutils /bin/sh
# dig example.com
```The console of the `Grpc` resolution backend should print the `DNS` query to be resolved.