README ¶
page_title: Docker discovery page_description: discovery page_keywords: docker, clustering, discovery
Discovery
Docker comes with multiple Discovery backends.
Backends
Using etcd
Point your Docker Engine instances to a common etcd instance. You can specify
the address Docker uses to advertise the node using the --cluster-advertise
flag.
$ docker daemon -H=<node_ip:2376> --cluster-advertise=<node_ip:2376> --cluster-store etcd://<etcd_ip1>,<etcd_ip2>/<path>
Using consul
Point your Docker Engine instances to a common Consul instance. You can specify
the address Docker uses to advertise the node using the --cluster-advertise
flag.
$ docker daemon -H=<node_ip:2376> --cluster-advertise=<node_ip:2376> --cluster-store consul://<consul_ip>/<path>
Using zookeeper
Point your Docker Engine instances to a common Zookeeper instance. You can specify
the address Docker uses to advertise the node using the --cluster-advertise
flag.
$ docker daemon -H=<node_ip:2376> --cluster-advertise=<node_ip:2376> --cluster-store zk://<zk_addr1>,<zk_addr2>/<path>
Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotSupported is returned when a discovery service is not supported. ErrNotSupported = errors.New("discovery service not supported") // ErrNotImplemented is returned when discovery feature is not implemented // by discovery backend. ErrNotImplemented = errors.New("not implemented in this discovery service") )
Functions ¶
func ParseAdvertise ¶
ParseAdvertise parses the --cluster-advertise daemon config which accepts <ip-address>:<port> or <interface-name>:<port>
Types ¶
type Backend ¶
type Backend interface { // Watcher must be provided by every backend. Watcher // Initialize the discovery with URIs, a heartbeat, a ttl and optional settings. Initialize(string, time.Duration, time.Duration, map[string]string) error // Register to the discovery. Register(string) error }
Backend is implemented by discovery backends which manage cluster entries.
type Entries ¶
type Entries []*Entry
Entries is a list of *Entry with some helpers.
func CreateEntries ¶
CreateEntries returns an array of entries based on the given addresses.
type Entry ¶
An Entry represents a host.
type Watcher ¶
type Watcher interface { // Watch the discovery for entry changes. // Returns a channel that will receive changes or an error. // Providing a non-nil stopCh can be used to stop watching. Watch(stopCh <-chan struct{}) (<-chan Entries, <-chan error) }
Watcher provides watching over a cluster for nodes joining and leaving.