Service discovery in
Docker environments
Alex Giurgiu
(alex@giurgiu.io)
Why?
• Average application size has increased
tremendously; from single machine to an army of
machines
• Big trend of splitting monolithic architectures in
SOA’s
• The need to see the infrastructure as a
homogeneous platform rather than a mix of
specialised machines.
Why?
• Docker based architectures encourage
compartmentalisation => a multitude of specialised
containers that need to find each other in an
automated way
• Rapidly changing environments demand an
effective way of managing state change => Puppet
driven DNS changes don't cut it anymore
How?
How?
• Plenty of tools, of various sizes and ages, among
which: directory services(DNS,LDAP), etcd,
skydock, smartstack, pacemaker, zookeeper,
doozerd, Consul, etc.
• Many ways to do it; no one-size-fits-all solution; it all
depends your infrastructure
• This presentation focuses on just one of the ways;
a way which applies well to Docker based
environments.
Consul
Consul
!
• Similar to etcd(from CoreOS)
• Made by Hashicorp(Vagrant, Packer and Serf)
• “Built on top of a foundation of rigorous academic
research” - read SWIM and RAFT papers
• Consistency through a quorum of nodes(RAFT)
• Excellent scalability because of its gossip based
communication protocol(SWIM)
Features
• DNS recursor
• Service health checks
• Support for multiple datacenters
• Key/Value store
• Query using DNS or HTTP
8
Concepts
• Consul agent can act
as a client or as a
server
• The client doest not
store any data,
forwards requests to
server
• Quorum forms
between servers
• Each DC acts as a
separate cluster, with
its own data
Example implementation
• Simple test environment
for puppet code
• 4 types of containers:
puppetmaster, git,
jenkins and
puppetvalidation
• Each container registers
with CONSUL when it
starts
• Git notifies puppetmaster
of any new commits
using CONSUL
Example implementation
• each node(physical or VM) runs its own Consul agent(can be
client or server)
• the Consul agent binds to the docker0 interface; all containers
started on the node can query it using their default gateway
• when a container starts it makes a call to the HTTP api to
register itself with consul using a JSON formatted string
echo "Registering PM service with consul
curl -X PUT -d {"ID": "puppetmaster1", ”Name”:”puppetmaster",
"Port":8600} http://$GWIP:8500/v1/agent/service/register
• once its registered the information will be gossiped
to all other Consul agents;
• all containers from all nodes should now be able to
access the service using DNS at
<name>.server.consul or using the HTTP API.
• any DNS request for names outside the .consul
domain will be forwarded to a configurable external
DNS server.
• git notification done using the Consul key/value
HTTP API
Service discovery in Docker environments
curl -X PUT -d 'true' http://$GWIP:8500/v1/kv/update/puppetmaster
sleep 3
curl http://jenkins.service.consul:8080/job/puppet-run/build
while [ true ]; do
echo "Waiting for git update(index higher than $MI)"
MI=`curl -s "http://$GWIP:8500/v1/kv/update/puppetmaster?index=
$MI" | awk -F "," '{ print $2 }' | cut -d ":" -f 2`
echo "New index is $MI"
echo "Modules updated. Pulling repo."
cd /etc/puppet/modules && git pull && cd -
done
On puppetmaster:
On git:
Demo
Questions

More Related Content

PPTX
Docker cluster with swarm, consul, registrator and consul-template
PDF
Consul - service discovery and others
PPTX
Microservices with docker swarm and consul
PDF
Beyond static configuration
PDF
Docker in production service discovery with consul - road to opscon 2015
PPTX
Docker Service Registration and Discovery
PDF
Service discovery in a microservice architecture using consul
PDF
Kubernetes intro public - kubernetes meetup 4-21-2015
Docker cluster with swarm, consul, registrator and consul-template
Consul - service discovery and others
Microservices with docker swarm and consul
Beyond static configuration
Docker in production service discovery with consul - road to opscon 2015
Docker Service Registration and Discovery
Service discovery in a microservice architecture using consul
Kubernetes intro public - kubernetes meetup 4-21-2015

What's hot (20)

PPTX
Introducing Docker Swarm - the orchestration tool by Docker
PPTX
Load Balancing Apps in Docker Swarm with NGINX
PDF
Consul and docker swarm cluster
PDF
Docker Online Meetup #28: Production-Ready Docker Swarm
PDF
Fluentd and docker monitoring
PDF
What's New in Docker 1.12?
PDF
Kubernetes Boston — Custom High Availability of Kubernetes
PDF
Docker Swarm 0.2.0
PDF
runC: The little engine that could (run Docker containers) by Docker Captain ...
PDF
Kubernetes 1.3 - Highlights
PPTX
Kubernetes HA @ AppDirect - Montreal Kubernetes Meetup
PPTX
Docker Swarm Introduction
PDF
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
PDF
Deploying and Scaling a Rails Application with Docker and Friends
PDF
Getting Started with Consul
PPTX
Container Monitoring with Sysdig
PPTX
Hashicorp: Delivering the Tao of DevOps
PDF
Clocker - The Docker Cloud Maker
PDF
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
Introducing Docker Swarm - the orchestration tool by Docker
Load Balancing Apps in Docker Swarm with NGINX
Consul and docker swarm cluster
Docker Online Meetup #28: Production-Ready Docker Swarm
Fluentd and docker monitoring
What's New in Docker 1.12?
Kubernetes Boston — Custom High Availability of Kubernetes
Docker Swarm 0.2.0
runC: The little engine that could (run Docker containers) by Docker Captain ...
Kubernetes 1.3 - Highlights
Kubernetes HA @ AppDirect - Montreal Kubernetes Meetup
Docker Swarm Introduction
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Deploying and Scaling a Rails Application with Docker and Friends
Getting Started with Consul
Container Monitoring with Sysdig
Hashicorp: Delivering the Tao of DevOps
Clocker - The Docker Cloud Maker
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
Ad

Similar to Service discovery in Docker environments (20)

PDF
PuppetConf 2016: Service Discovery and Puppet – Marc Cluet, Ukon Cherry
PDF
Service discovery and puppet
PDF
Docker Online Meetup #3: Docker in Production
PDF
Common primitives in Docker environments
PDF
Swarm: Native Docker Clustering
PDF
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
PPTX
Discover/Register Everything in consul
PDF
Shipping Applications to Production in Containers with Docker
PDF
11thDockerMeetupSwitzerland
PDF
Overcoming 5 Common Docker Challenges: How We Do It at RightScale
PPTX
Puppet and docker
PDF
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
PDF
ApacheCon Core: Service Discovery in OSGi: Beyond the JVM using Docker and Co...
PPTX
Nats meetup oct 2016 docker 112
PDF
Containerization Is More than the New Virtualization
PDF
You got a couple Microservices, now what? - Adding SRE to DevOps
PDF
The State of Linux Containers
PDF
Docker tlv
PDF
From Monolith to Docker Distributed Applications
PDF
New Docker Features for Orchestration and Containers
PuppetConf 2016: Service Discovery and Puppet – Marc Cluet, Ukon Cherry
Service discovery and puppet
Docker Online Meetup #3: Docker in Production
Common primitives in Docker environments
Swarm: Native Docker Clustering
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Discover/Register Everything in consul
Shipping Applications to Production in Containers with Docker
11thDockerMeetupSwitzerland
Overcoming 5 Common Docker Challenges: How We Do It at RightScale
Puppet and docker
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
ApacheCon Core: Service Discovery in OSGi: Beyond the JVM using Docker and Co...
Nats meetup oct 2016 docker 112
Containerization Is More than the New Virtualization
You got a couple Microservices, now what? - Adding SRE to DevOps
The State of Linux Containers
Docker tlv
From Monolith to Docker Distributed Applications
New Docker Features for Orchestration and Containers
Ad

Recently uploaded (20)

PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PPTX
Configure Apache Mutual Authentication
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
4 layer Arch & Reference Arch of IoT.pdf
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
giants, standing on the shoulders of - by Daniel Stenberg
DOCX
search engine optimization ppt fir known well about this
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Basics of Cloud Computing - Cloud Ecosystem
UiPath Agentic Automation session 1: RPA to Agents
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
Configure Apache Mutual Authentication
NewMind AI Weekly Chronicles – August ’25 Week IV
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
4 layer Arch & Reference Arch of IoT.pdf
A review of recent deep learning applications in wood surface defect identifi...
Credit Without Borders: AI and Financial Inclusion in Bangladesh
sbt 2.0: go big (Scala Days 2025 edition)
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Taming the Chaos: How to Turn Unstructured Data into Decisions
giants, standing on the shoulders of - by Daniel Stenberg
search engine optimization ppt fir known well about this
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
OpenACC and Open Hackathons Monthly Highlights July 2025

Service discovery in Docker environments

  • 1. Service discovery in Docker environments Alex Giurgiu ([email protected])
  • 2. Why? • Average application size has increased tremendously; from single machine to an army of machines • Big trend of splitting monolithic architectures in SOA’s • The need to see the infrastructure as a homogeneous platform rather than a mix of specialised machines.
  • 3. Why? • Docker based architectures encourage compartmentalisation => a multitude of specialised containers that need to find each other in an automated way • Rapidly changing environments demand an effective way of managing state change => Puppet driven DNS changes don't cut it anymore
  • 5. How? • Plenty of tools, of various sizes and ages, among which: directory services(DNS,LDAP), etcd, skydock, smartstack, pacemaker, zookeeper, doozerd, Consul, etc. • Many ways to do it; no one-size-fits-all solution; it all depends your infrastructure • This presentation focuses on just one of the ways; a way which applies well to Docker based environments.
  • 7. Consul ! • Similar to etcd(from CoreOS) • Made by Hashicorp(Vagrant, Packer and Serf) • “Built on top of a foundation of rigorous academic research” - read SWIM and RAFT papers • Consistency through a quorum of nodes(RAFT) • Excellent scalability because of its gossip based communication protocol(SWIM)
  • 8. Features • DNS recursor • Service health checks • Support for multiple datacenters • Key/Value store • Query using DNS or HTTP 8
  • 9. Concepts • Consul agent can act as a client or as a server • The client doest not store any data, forwards requests to server • Quorum forms between servers • Each DC acts as a separate cluster, with its own data
  • 10. Example implementation • Simple test environment for puppet code • 4 types of containers: puppetmaster, git, jenkins and puppetvalidation • Each container registers with CONSUL when it starts • Git notifies puppetmaster of any new commits using CONSUL
  • 11. Example implementation • each node(physical or VM) runs its own Consul agent(can be client or server) • the Consul agent binds to the docker0 interface; all containers started on the node can query it using their default gateway • when a container starts it makes a call to the HTTP api to register itself with consul using a JSON formatted string echo "Registering PM service with consul curl -X PUT -d {"ID": "puppetmaster1", ”Name”:”puppetmaster", "Port":8600} http://$GWIP:8500/v1/agent/service/register
  • 12. • once its registered the information will be gossiped to all other Consul agents; • all containers from all nodes should now be able to access the service using DNS at <name>.server.consul or using the HTTP API. • any DNS request for names outside the .consul domain will be forwarded to a configurable external DNS server. • git notification done using the Consul key/value HTTP API
  • 14. curl -X PUT -d 'true' http://$GWIP:8500/v1/kv/update/puppetmaster sleep 3 curl http://jenkins.service.consul:8080/job/puppet-run/build while [ true ]; do echo "Waiting for git update(index higher than $MI)" MI=`curl -s "http://$GWIP:8500/v1/kv/update/puppetmaster?index= $MI" | awk -F "," '{ print $2 }' | cut -d ":" -f 2` echo "New index is $MI" echo "Modules updated. Pulling repo." cd /etc/puppet/modules && git pull && cd - done On puppetmaster: On git:
  • 15. Demo