Skip to content

Instantly share code, notes, and snippets.

@topiaruss
Created July 2, 2015 22:33
Show Gist options
  • Save topiaruss/a6e69ccfb8bce360d7e2 to your computer and use it in GitHub Desktop.
Save topiaruss/a6e69ccfb8bce360d7e2 to your computer and use it in GitHub Desktop.
$ docker-machine create -d virtualbox local
$ eval "$(docker-machine env local)"
$ docker run swarm create
..
357150828546349cb76f0b0b21af2f1a
$ docker-machine create \
-d virtualbox \
--swarm \
--swarm-master \
--swarm-discovery token:357150828546349cb76f0b0b21af2f1a \
swarm-master
$ docker-machine create \
-d virtualbox \
--swarm \
--swarm-discovery token:357150828546349cb76f0b0b21af2f1a \
swarm-agent-00
$ docker-machine create \
-d virtualbox \
--swarm \
--swarm-discovery token:357150828546349cb76f0b0b21af2f1a \
swarm-agent-01
$ eval "$(docker-machine env swarm-master)"
# Note below that the agents list their master in the SWARM column.
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
dev virtualbox Running tcp://192.168.99.117:2376
local virtualbox Running tcp://192.168.99.113:2376
staging digitalocean Running tcp://45.55.81.106:2376
swarm-agent-00 virtualbox Running tcp://192.168.99.115:2376 swarm-master
swarm-agent-01 virtualbox Running tcp://192.168.99.116:2376 swarm-master
swarm-master * virtualbox Running tcp://192.168.99.114:2376 swarm-master (master)
# Below command now gives me info about the swarm-master host
$ docker info
Containers: 2
Images: 7
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 11
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.5-boot2docker
Operating System: Boot2Docker 1.7.0 (TCL 6.3); master : 7960f90 - Thu Jun 18 18:31:45 UTC 2015
CPUs: 1
Total Memory: 996.2 MiB
Name: swarm-master
ID: KL26:LSZU:EOGI:F5GT:TBQU:VMWB:IUJK:JLBM:4PTS:NLSL:SVWE:IXOL
Debug mode (server): true
File Descriptors: 20
Goroutines: 33
System Time: 2015-07-02T22:19:37.494932878Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
provider=virtualbox
$ eval "$(docker-machine env --swarm swarm-master)"
# Because I added --swarm option, below I get the swarm data... But no nodes listed. Why?
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
dev virtualbox Running tcp://192.168.99.117:2376
local virtualbox Running tcp://192.168.99.113:2376
staging digitalocean Running tcp://45.55.81.106:2376
swarm-agent-00 virtualbox Running tcp://192.168.99.115:2376 swarm-master
swarm-agent-01 virtualbox Running tcp://192.168.99.116:2376 swarm-master
swarm-master virtualbox Running tcp://192.168.99.114:2376 swarm-master (master)
$ docker info
Containers: 0
Images: 0
Role: primary
Strategy: spread
Filters: affinity, health, constraint, port, dependency
Nodes: 0
CPUs: 0
Total Memory: 0 B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment