diff --git a/README.md b/README.md index ec232fbcea..7ae5ec2756 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This can be achieved by starting Docker with the `-H` flag (e.g. `-H 0.0.0.0:237 Currently, nodes must be running the Docker **master** version. Master binaries are available here: https://master.dockerproject.com/ -### Example usage: using the hosted discovery service +### Example usage ```bash # create a cluster @@ -51,51 +51,8 @@ $ swarm list --discovery token://6856663cdefdec325839a4b7e1de38e8 http:// ``` -### Example usage: using a static file describing the cluster - -```bash -# for each of your nodes, add a line to a file -# doesn't have to be public (eg. 192.168.0.X), -# as long as the other nodes can reach it, it is fine. -$ echo >> /tmp/my_cluster - -# start the manager on any machine or your laptop -$ swarm manage --discovery file:///tmp/my_cluster --addr= - -# use the regular docker cli -$ docker -H info -$ docker -H run ... -$ docker -H ps -$ docker -H logs ... -... - -# list nodes in your cluster -$ swarm list --discovery file:///tmp/my_cluster -http:// -``` - -### Example usage: using etcd - -```bash -# on each of your nodes, start the swarm agent -# doesn't have to be public (eg. 192.168.0.X), -# as long as the other nodes can reach it, it is fine. -$ swarm join --discovery etcd:///>path> --addr= - -# start the manager on any machine or your laptop -$ swarm manage --discovery etcd:///>path> --addr= - -# use the regular docker cli -$ docker -H info -$ docker -H run ... -$ docker -H ps -$ docker -H logs ... -... - -# list nodes in your cluster -$ swarm list --discovery etcd:///>path> -http:// -``` +See [here](https://github.com/docker/swarm/discovery) for more information about +other discovery services. ### TLS diff --git a/discovery/README.md b/discovery/README.md index 34c1a78ea0..7d3a69c4a3 100644 --- a/discovery/README.md +++ b/discovery/README.md @@ -1,17 +1,100 @@ Discovery ========= +`Docker Swarm` comes with multiple Discovery backends + +## Examples + +##### Using the hosted discovery service + +```bash +# create a cluster +$ swarm create +6856663cdefdec325839a4b7e1de38e8 + +# on each of your nodes, start the swarm agent +# doesn't have to be public (eg. 192.168.0.X), +# as long as the other nodes can reach it, it is fine. +$ swarm join --discovery token://6856663cdefdec325839a4b7e1de38e8 --addr= + +# start the manager on any machine or your laptop +$ swarm manage --discovery token://6856663cdefdec325839a4b7e1de38e8 --addr= + +# use the regular docker cli +$ docker -H info +$ docker -H run ... +$ docker -H ps +$ docker -H logs ... +... + +# list nodes in your cluster +$ swarm list --discovery token://6856663cdefdec325839a4b7e1de38e8 +http:// +``` + +###### Using a static file describing the cluster + +```bash +# for each of your nodes, add a line to a file +# doesn't have to be public (eg. 192.168.0.X), +# as long as the other nodes can reach it, it is fine. +$ echo >> /tmp/my_cluster + +# start the manager on any machine or your laptop +$ swarm manage --discovery file:///tmp/my_cluster --addr= + +# use the regular docker cli +$ docker -H info +$ docker -H run ... +$ docker -H ps +$ docker -H logs ... +... + +# list nodes in your cluster +$ swarm list --discovery file:///tmp/my_cluster +http:// +``` + +###### Using etcd + +```bash +# on each of your nodes, start the swarm agent +# doesn't have to be public (eg. 192.168.0.X), +# as long as the other nodes can reach it, it is fine. +$ swarm join --discovery etcd:///>path> --addr= + +# start the manager on any machine or your laptop +$ swarm manage --discovery etcd:///>path> --addr= + +# use the regular docker cli +$ docker -H info +$ docker -H run ... +$ docker -H ps +$ docker -H logs ... +... + +# list nodes in your cluster +$ swarm list --discovery etcd:///>path> +http:// +``` + +## Contributing + Contributing a new discovery backend is easy, simply implements this interface: ```go type DiscoveryService interface { + Initialize(string, int) error Fetch() ([]string, error) - Watch(int) <-chan time.Time + Watch() <-chan time.Time Register(string) error } ``` +######Initialize +take the `--dicovery` withtout the scheme and a heartbeat (in seconds) + ######Fetch returns the list of all the nodes from the discovery