Skip to content

Instantly share code, notes, and snippets.

@populov
Last active July 27, 2017 20:46
Show Gist options
  • Select an option

  • Save populov/3e5b8f9a3190e1df32a6976c700aea9b to your computer and use it in GitHub Desktop.

Select an option

Save populov/3e5b8f9a3190e1df32a6976c700aea9b to your computer and use it in GitHub Desktop.
Docker consul DNS
#!/bin/bash
# run with sudo!
echo "server=/service.docker/127.0.0.1#8600" > /etc/NetworkManager/dnsmasq.d/consul-tld
echo "address=/.lo/127.0.0.1" > /etc/NetworkManager/dnsmasq.d/lo-tld
service network-manager restart
version: '2.1'
services:
consul:
image: gliderlabs/consul-server
container_name: consul
network_mode: host
restart: always
command: -bootstrap -domain=docker -advertise=127.0.0.1
registrator:
container_name: registrator
image: gliderlabs/registrator:latest
network_mode: host
restart: always
volumes:
- /var/run/docker.sock:/tmp/docker.sock
command: -internal consul://localhost:8500
depends_on:
- consul
#!/bin/bash
# Run consul
docker run -d \
--name=consul \
--net=host \
--restart=always \
gliderlabs/consul-server \
-bootstrap -domain=docker -advertise=127.0.0.1
# Run registrator
docker run -d \
--name=registrator \
--net=host \
--restart=always \
--volume=/var/run/docker.sock:/tmp/docker.sock \
gliderlabs/registrator:latest \
-internal consul://localhost:8500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment