Last active
June 28, 2020 07:55
-
-
Save rijnhard/3488f0ef9699fb57edf4 to your computer and use it in GitHub Desktop.
[Consul + Registrator] #docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sysvinit /etc/default/docker | |
#append '--bip=172.17.42.1/24 --dns=172.17.42.1' to DOCKER_OPTS | |
DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock --bip 172.17.42.1/24 --dns 172.17.42.1 --dns 8.8.8.8 --dns 8.8.4.4 --dns-search service.consul" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Resources # | |
# http://howtocookmicroservices.com/docker-compose/#docker-compose-1 | |
# http://artplustech.com/docker-consul-dns-registrator/ | |
# | |
# Service Discovery - Consul | |
# | |
consul: | |
container_name: consul | |
# http://artplustech.com/docker-consul-dns-registrator/ | |
# only difference to the server is that it has the web ui | |
image: gliderlabs/consul-server:latest | |
# Options: https://www.consul.io/docs/agent/options.html#_client | |
command: -server -bootstrap | |
ports: | |
- "8300:8300" | |
- "8400:8400" | |
- "8500:8500" | |
- "172.17.42.1:53:8600/udp" | |
# it is very very important to bind the fixed docker bridge IP and DNS port to 8600 | |
# | |
# Service Discovery - Registrator | |
# | |
registrator: | |
container_name: registrator | |
image: gliderlabs/registrator:latest | |
#Options: http://gliderlabs.com/registrator/latest/user/run/ | |
command: -internal consul://consul:8500 | |
links: | |
- consul | |
volumes: | |
- "/var/run/docker.sock:/tmp/docker.sock" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Systemd /lib/systemd/system/docker.service | |
#append '--bip=172.17.42.1/24 --dns=172.17.42.1' to ExecStart | |
ExecStart=/usr/bin/docker daemon -H fd:// --bip=172.17.42.1/24 --dns=172.17.42.1 --dns=8.8.8.8 --dns=8.8.4.4 --dns-search=service.consul |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/resolv.conf | |
#add 'nameserver 172.17.42.1' | |
nameserver 172.17.42.1 | |
#this one should already exist | |
nameserver 127.0.1.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment