DNS And Docker Containers
wiredcraft.com
wiredcraft.com
docker inspect $CONTAINER | grep -i VAR
pattern alot until I discovered that you can do use the container name and do go with: docker inspect --format '{{ .NetworkSettings.IPAddress }}' replset1
Service discovery and docker is still a pain point with the technology. Serf [1] and etcd [2] are tools that manages a cluster of services and helps solve the problem described in the article.[1] Serf is by the guys behind Vagrant. - http://www.serfdom.io/
[2] etcd - http://coreos.com/using-coreos/etcd/
Why have a different methodology for local dev and deploy when you could have the SAME methodology for local and deploy with almost no extra cost?
Before that, I was using SkyDNS but I was not happy in having to maintain/reset the TTL.
Side note: when you use --dns on a container and commit the result to an image, that image will have the --dns value in its /etc/resolv.conf (meaning that you still have to run a DNS at that address or to provide again --dns to supply a new address).
Thanks for the --dns tip!
This means that I can run that script more than once on my laptop and have multiple triple (`app`, `db`,` ns`) side by side without fear of crosstalking between logical groups.
Eventually we merged that logic in an in-house app we built back in the days when the containers orchestration tools were still "rare", if i recall https://github.com/toscanini/maestro had just launched but wasn't really usable yet...
What's frustrating is that I don't think Docker currently has an elegant way to make you not care if the remote service is local or not. What'd be interesting is if there was a special tun interface for that kind of communication and you could bind that to local containers or just dump the traffic back onto your LAN, NAT'd to a remote host.
At that point, you aren't really doing anything different than you were before with managing servers & load balancing. I don't care if I have 1 app server or 10,000 app servers as long as they are functionally identical and interchangeable. One of them loses a container? Restart the container. That fails? Kill the instance and rebuild.
Besides compute and indexing farms, what sort of deploys demonstrate that pattern?
I store it in a separate pool of servers that are solely for database nodes. At which point, I'm back to the "Service Discovery does not require a Docker-aware design."
I think the issue here is I'm used to different assumptions than other people. I virtualize application/service containers. I don't virtualize the datastores but run those on bare metal whenever possible.
So it goes LB -> pool of docker containers -> Database Cluster(s). The database cluster(s) are known in advance and are restored to the same DNS location when they are revived/moved/transferred. [e.g. I have a cluster of 5 DB servers, they are always something like galera1-servicegroup through galera5-servicegroup, or whatever]
Always wondering of the extra round-trip on DNS request when we could have a hardcoded value in the host. We're talking local network so the latency ain't much of an issue but still. Then there is the possibility of a dnsmasq restart when a request occur, caching ala nscd could work, but then we're in for a lot more trouble when it comes to expire that cache !