Skip to content

Installation with Docker Machine

Erika Pauwels edited this page Apr 21, 2016 · 1 revision

This guide describes how to install the BDE platform including Docker Swarm with overlay networks (i.e. a network spanning multiple nodes) on your cluster using Docker Machine. Docker Machine is a tool that lets you install Docker Engine on virtual hosts on your local machine or in the cloud.

Each machine runs a Docker daemon. One machine just hosts a (Consul key-value store). This store is used for the bookkeeping of the nodes and networks in the swarm. Another machine serves as Swarm manager. This is the main entry point for the Docker Client to run applications on the cluster. All the other machines are part of the swarm. They each run a Swarm agent and can communicate via overlay networks.

Install Docker Machine

Install Docker

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
$ sudo nano /etc/apt/sources.list.d/docker.list

Add the following line to the file and save:

deb https://apt.dockerproject.org/repo ubuntu-trusty main

Update packages and install Docker

$ sudo apt-get update
$ sudo apt-get install linux-image-extra-$(uname -r)
$ sudo apt-get install docker-engine

Install Docker Machine

  • If you are running OS X or Linux
$ curl -L https://github.com/docker/machine/releases/download/v0.6.0/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine && \
chmod +x /usr/local/bin/docker-machine
  • If you are running Windows
$ if [[ ! -d "$HOME/bin" ]]; then mkdir -p "$HOME/bin"; fi && \
curl -L https://github.com/docker/machine/releases/download/v0.6.0/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" && \
chmod +x "$HOME/bin/docker-machine.exe"

Setup a key-value store

Create a new machine

$ docker-machine create -d virtualbox keystore

Set your local environment to the keystore machine

$ eval "$(docker-machine env keystore)"

Start Consul key-value store

$ docker run -d \
    -p "8500:8500" \
    -h "consul" \
    progrium/consul -server -bootstrap

Start a Swarm Manager

Create a new machine running a Swarm Manager

$ docker-machine create \
    -d virtualbox \
    --swarm --swarm-master \
    --swarm-discovery="consul://$(docker-machine ip keystore):8500" \
    --engine-opt="cluster-store=consul://$(docker-machine ip keystore):8500" \
    --engine-opt="cluster-advertise=eth1:2376" \
    node-1

Start nodes in the swarm

Start a new machine in the swarm

$ docker-machine create -d virtualbox \
    --swarm \
    --swarm-discovery="consul://$(docker-machine ip keystore):8500" \
    --engine-opt="cluster-store=consul://$(docker-machine ip keystore):8500" \
    --engine-opt="cluster-advertise=eth1:2376" \
    node-2

Repeat this step to create multiple nodes in your swarm.

Run docker-machine ls to validate your setup. It will list all machines and indicate to which swarm they belong. You can also issue the info command to the Swarm Manager to list the nodes in the swarm:

$ eval $(docker-machine env --swarm node-1)
$ docker info
You can’t perform that action at this time.