Installation

Host Options

  • A. Play With Docker

    • Only needs a browser, but resets after 4 hours

  • B. docker-machine + VirtualBox (Hyper-V / Parallels / etc.)

  • C. Digital Ocean + Docker install

    • Most like a production setup, but costs $5-$10/node/month while learning

    • Use my referral code from below links to get $10 free

  • D. Roll your own

    • docker-machine can provision machines from Amazon, Azure, DO, Google, etc.

    • Install docker anywhere with get.docker.com

play-with-docker

docker-machine

  • I was on my Windows when writing section so I'll use Hyper-V driver

  • (Hyper-V has to be run as an Administrator)

  • Follow this to setup external virtual switch

# Linux/MacOS
~> docker-machine create node1
~> docker-machine create node2
~> docker-machine create node3

# Windows with Hyper-V
~> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" node1
~> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" node2
~> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" node3

~> docker-machine ssh node1
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 17.09.0-ce, build HEAD : 06d5c35 - Wed Sep 27 23:22:43 UTC 2017
Docker version 17.09.0-ce, build afdb6d4

Powershell scripts to simplify setup of nodes

function Start-SwarmCluster {
  docker-machine start node1 node2 node3
  Set-SwarmClusterVariables
}

function New-SwarmCluster {
  docker-machine create -d hyperv node1
  docker-machine create -d hyperv node2
  docker-machine create -d hyperv node3
  Set-SwarmClusterVariables -Node node1
}

function Set-SwarmClusterVariables($Node) {
  docker-machine env --shell powershell $Node | Invoke-Expression
}

function Reset-SwarmClusterVariables {
  Remove-Item Env:\DOCKER_TLS_VERIFY
  Remove-Item Env:\DOCKER_HOST
  Remove-Item Env:\DOCKER_CERT_PATH
  Remove-Item Env:\DOCKER_MACHINE_NAME
}

function Stop-SwarmCluster {
  docker-machine stop node1 node2 node3
  Reset-SwarmClusterVariables
}

function Remove-SwarmCluster {
  docker-machine rm node1 node2 node3
  Reset-SwarmClusterVariables
}

Digital Ocean

  • Create droplets

    • Ubuntu 16.04 x64

    • $5 one should be enough

    • datacenter close to you

    • Add an SSH key

  • Creating these 3 droplets took about 10 seconds

  • Use script from https://get.docker.com/ to install Docker

  • Firewall ports that needs to be open are below in external links

Scaleway

  • This is much cheaper + you can create servers without public IP which seems to be as a good option for Docker.

  • I have my VPS there, but I haven't explored their functionality for Docker yet

  • They have prepared image with this Docker functionality:

    • Features:

      • Docker compose

      • fig

      • gosu

      • nsenter

      • pipework

    • Storage drivers:

      • aufs (default)

      • btrfs

      • devicemapper

Last updated

Was this helpful?