explaingit

gliderlabs/registrator

4,675GoAudience · ops devopsComplexity · 3/5LicenseSetup · moderate

TLDR

A Go tool that automatically registers and deregisters Docker container services with Consul, etcd, or SkyDNS, so your infrastructure always has an up-to-date directory of which services are running and where.

Mindmap

mindmap
  root((Registrator))
    What it does
      Auto-registers services
      Watches Docker events
      Removes on stop
    Supported Registries
      Consul
      etcd
      SkyDNS 2
    Config Options
      TTL expiry
      Service tags
      Explicit mode
    Deployment
      Runs as container
      Docker socket access
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Automatically register every Docker container's service in Consul so other services can discover it without manual configuration.

USE CASE 2

Set up service TTLs so stale registry entries expire automatically if Registrator itself goes offline.

USE CASE 3

Add tags and metadata to all registered services for easier filtering in your service registry.

USE CASE 4

Use explicit opt-in mode so only containers labeled for registration get added to the service registry.

Tech stack

GoDockerConsuletcdSkyDNS

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a running Docker host and an accessible Consul, etcd, or SkyDNS instance.

Use freely for any purpose including commercial, just keep the copyright notice.

In plain English

Registrator is a tool that automatically handles service registration for applications running inside Docker containers. When a container starts up, Registrator detects it and registers the service with a service registry so other parts of your infrastructure know it exists and how to reach it. When a container stops, Registrator removes the entry. This removes the need for each application to manage its own registration logic. Service registries are systems that keep a live directory of running services and their network addresses. Registrator supports three of them: Consul, etcd, and SkyDNS 2. You point Registrator at whichever one you use by passing its address as a command-line argument when starting Registrator itself. You run Registrator as a Docker container on the same host as your other containers. It connects to the Docker socket, which lets it watch for container events. The provided run command passes it Consul's address as the target registry. From that point it monitors container starts and stops and updates Consul accordingly. There are several configuration options. You can set a TTL so registered services expire automatically if Registrator itself goes offline, control whether it resynchronizes its records on an interval, add tags to all registered services, and choose whether deregistration happens immediately when a container exits or only when it exits cleanly. An explicit mode lets you opt in to registration on a per-container basis using labels. The project is licensed under MIT and accepts pull requests. A developer guide for building custom registry backends is available in the full documentation.

Copy-paste prompts

Prompt 1
Help me set up Registrator to automatically sync my Docker containers' services into Consul on a new Linux server.
Prompt 2
Write a Docker Compose file that runs Registrator alongside my app containers and registers them in Consul with a 30-second TTL.
Prompt 3
How do I configure Registrator's explicit mode so only specific containers labeled for registration get added to my service registry?
Prompt 4
Help me build a custom registry backend plugin for Registrator that writes service entries to my own service discovery system.
Prompt 5
How can I verify that Registrator successfully registered my new Docker container in etcd after it starts up?
Open on GitHub → Explain another repo

← gliderlabs on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.