Skip to content

Instantly share code, notes, and snippets.

@skippy
Last active August 29, 2015 14:12
Show Gist options
  • Save skippy/29d6c579103535f18fcf to your computer and use it in GitHub Desktop.
Save skippy/29d6c579103535f18fcf to your computer and use it in GitHub Desktop.
modifying the docker host's /etc/hosts file with the location of a private docker-registry so we don't need to restart the docker daemon (and force all the containers to restart0
# run from a coreos fleet file; change as you see fit
# NOTE: this shares the /etc folder with docker; ugh!
# using multiple -v doesn't seem to work (as consul-template
# does atomic writes, which requires writing a tmp file
# then moving it).
docker run --rm \
--name docker-registry \
-e SERVICE_IGNORE=1 \
-v /etc:/configs \
skippy/consul-template \
-consul ${COREOS_PRIVATE_IPV4}:8500 \
-template "/configs/hosts.ctmpl:/configs/hosts"
# save at /etc/hosts.ctmpl
{{range service "private-registry"}}
{{.Address}} {{.Name}}.service.consul {{.Name}}.service.consul{{end}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment