fayrus/registrator

Sponsored OSS

By Fayrus

•Updated 19 days ago

Docker service registry bridge

Image
Networking
1

10K+

fayrus/registrator repository overview

⁠Registrator

Service registry bridge for Docker.

Docker pulls Docker Image Version Build and Push Docker Image

Registrator watches Docker events and keeps your service registry in sync — automatically registering containers when they start and deregistering them when they stop. No changes to your containers required: configuration is driven entirely by SERVICE_ environment variables and labels.

Supports Consul⁠, etcd⁠, ZooKeeper⁠, and CoreDNS⁠.

Multi-architecture support: linux/amd64, linux/arm64 — built with Chainguard hardened images.

For linux/arm/v7, linux/arm/v6 and linux/386 support, use v8.0.1⁠.

Note: The SkyDNS2 backend was removed in v8.0.4 (abandoned since 2016). It has been replaced by the coredns:// backend introduced in v9.0.0.

⁠Getting Started

Pull the latest release from Docker Hub⁠:

docker pull fayrus/registrator:latest

Version tags are available to pin to a specific release (e.g. :v9.0.0, :v9.0, :v9).

⁠Usage

docker run -d \
  --name=registrator \
  --net=host \
  --volume=/var/run/docker.sock:/tmp/docker.sock \
  fayrus/registrator:latest \
    consul://localhost:8500

⁠Supported Backends

URI schemeBackendNotes
consul://HashiCorp Consul
consul-tls://HashiCorp ConsulTLS
consul-unix://HashiCorp ConsulUnix socket
etcd://etcdLegacy v2 API
etcd2://etcdv3 client, multi-endpoint, TLS
coredns://CoreDNSWrites SkyDNS-format records to etcd; requires CoreDNS with the etcd plugin
zookeeper://Apache ZooKeeper
⁠etcd2 — environment variables
VariableDescription
ETCD_ENDPOINTSComma-separated list of additional etcd endpoints
ETCD_CERT_FILEPath to client certificate
ETCD_KEY_FILEPath to client key
ETCD_CA_CERT_FILEPath to CA certificate

The coredns:// backend uses the same TLS variables.

⁠CLI Options

Usage of /bin/registrator:
  /bin/registrator [options] <registry URI>

  -cleanup=false:          Remove dangling services
  -deregister="always":    Deregister exited services "always" or "on-success"
  -explicit=false:         Only register containers that have SERVICE_NAME set
  -internal=false:         Use internal ports instead of published ones
  -ip="":                  IP for ports mapped to the host
  -ip-from-container=false: Use container IP instead of host IP for service registration
  -resync=0:               Frequency with which services are resynchronized
  -useIpFromLabel="":      Use IP stored in the given container label instead of the host IP
  -retry-attempts=0:       Max retry attempts to establish a connection with the backend. Use -1 for infinite retries
  -retry-interval=2000:    Interval (in milliseconds) between retry attempts
  -tags="":                Append tags for all registered services (supports Go template)
  -ttl=0:                  TTL for services (default is no expiry)
  -ttl-refresh=0:          Frequency with which service TTLs are refreshed

⁠Service Configuration

Registrator reads configuration from container environment variables prefixed with SERVICE_.

VariableDescription
SERVICE_NAMEOverride the service name
SERVICE_TAGSComma-separated tags. Supports Go templates (e.g. {{.Config.Hostname}})
SERVICE_<port>_NAMEName for a specific port
SERVICE_<port>_<protocol>_NAMEName for a specific port and protocol (e.g. SERVICE_80_tcp_NAME)
SERVICE_<N>-<M>_IGNOREIgnore all ports in range N–M (e.g. SERVICE_10000-20000_IGNORE=true)
SERVICE_IGNOREIgnore this container entirely
SERVICE_CHECK_HTTPHTTP health check path
SERVICE_CHECK_HTTPSHTTPS health check path
SERVICE_CHECK_TCPTCP health check
SERVICE_CHECK_SCRIPTScript health check (space-separated args)
SERVICE_CHECK_GRPCgRPC health check
SERVICE_CHECK_TTLTTL-based health check
SERVICE_CHECK_INTERVALHealth check interval (default 10s)
SERVICE_CHECK_TIMEOUTHealth check timeout
SERVICE_CHECK_TLS_SKIP_VERIFYSkip TLS verification for health checks
SERVICE_ENABLE_TAG_OVERRIDEAllow external agents to update tags in Consul without registrator overwriting them

⁠Contributing

Pull requests are welcome. Open a GitHub issue⁠ to discuss before starting.

⁠License

MIT

Tag summary

Content type

Image

Digest

sha256:c9faab7ba…

Size

12.6 MB

Last updated

19 days ago

docker pull fayrus/registrator:v9

This week's pulls

Pulls:

152

Last week