Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
- README docs
- Removed MAINTAINER in Dockerfile as soon to be deprecated
  • Loading branch information
lmakarov committed Jan 20, 2017
1 parent 42b64a7 commit b4b29fa
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM alpine:3.4

MAINTAINER Team Docksal, https://docksal.io

RUN apk add --no-cache \
curl \
supervisor \
Expand Down
65 changes: 63 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# DNS Docker image for Docksal

docker-gen generates a configuration for dnsmasq and reloads it when containers are started and stopped.

This image(s) is part of the [Docksal](http://docksal.io) image library.

Provides wildcard domain name resolution for local development.

## Features

- Wildcard domain name resolution
- Service discovery for containers

### Wildcard domain name resolution

```bash
$ docker run --name dns -d -e DNS_DOMAIN=docksal -e DNS_IP=192.168.64.100 -e docksal/dns

$ nslookup something.docksal 192.168.64.100
Server: 192.168.64.100
Address: 192.168.64.100#53

Name: something.docksal
Address: 192.168.64.100
```

Replace `192.168.64.100` with your Docker host IP.

### Service discovery for containers

This image has docker-gen built-in. Whenever containers start or stop the DNS configuration will be updated.

User either the `DNS_NAME` environment variable or the `dns.name` label with your containers to assign them
an arbitrary domain name. The assigned domain name will be resolved to the container's internal IP address.

```bash
docker run --name dns-test -d -e DNS_NAME=test.mydomain.com busybox top

$ nslookup test2.mydomain2.com 192.168.64.100
Server: 192.168.64.100
Address: 192.168.64.100#53

Name: test2.mydomain2.com
Address: 172.17.0.5
```

```bash
$ docker run --name dns-test2 -d --label dns.name=test2.mydomain2.com busybox top

$ nslookup test.mydomain.com 192.168.64.100
Server: 192.168.64.100
Address: 192.168.64.100#53

Name: test.mydomain.com
Address: 172.17.0.6
```

Replace `192.168.64.100` with your Docker host IP.

## Debugging

Launch the container with `LOG_QUERIES=true` to enabled query logging.

```bash
docker run --name dns -d -e DNS_DOMAIN=docksal -e DNS_IP=192.168.100.64 -e LOG_QUERIES=true docksal/dns
```

View logs with `docker logs dns`
2 changes: 1 addition & 1 deletion conf/dnsmasq.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ address=/{{ $host }}/{{ $network.IP }}
{{ end }}
{{ end }}

{{/* Configuration via "DNS_NAME" envitonment variables */}}
{{/* Configuration via "DNS_NAME" environment variables */}}
{{ range $host, $containers := groupByMulti $ "Env.DNS_NAME" "," }}
{{ range $index, $container := $containers }}
{{ template "host" (dict "Container" $container "Host" (print $host) "Tld" "") }}
Expand Down

0 comments on commit b4b29fa

Please sign in to comment.