2016年11月13日 星期日

[install, docker-machine] How to install docker-machine

How to install docker-machine

你連本身裝 docker 這件事, 都可以交給 docker-machine 代勞, 利用 docker-machine 指令, 你可以用一個指令就在自己的機器上建立 VirtualBox/VMware VM 或者是遠端 Amazon EC2/Google CE/ OpenStack 平台, 建立 docker ready 的機器.
接著, 你就可以讓你的 app 透過 docker-compose 以及 swarm 部署在那些 機器上面, 建立的叢集式的服務.
在邏輯的角度來看, 實體機器, 虛擬機器, 多個 container 是否在一台機器上, 已經沒有差別了. 透過 docker-machine, docker-compose, swarm, 你可以把你的程式 (服務) 隨時部署在任何容器中, 不管容器在哪裡執行. 機器將變成只是提供水電基本款的基礎, 服務為王的時代就是這樣實現.


Google doc: This document.

Installation

Step 1: Install Docker Binary
[docker, install] How to install docker (view)

Step 2: Install Docker-Machine
$ 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

VirtualBox

Comand
docker-machine crete --driver=virtualbox {your-machine-name}
docker-machine create --driver=virtualbox vbox-test

e.g.


Reference




How to ssh to a docker-machine
Github: Download

Command

docker-machine ssh {your-machine-name}

e.g.
docker-machine ls
docker-machine ssh myDockerMachine1



How to copy file/folder to your docker-machine

Command

local -> docker machine

docker-machine scp {your-local-file} {your-docker-machine}:{fullfilename}

docker machine -> local

Docker-machine scp {your-docker-machine}:{fullfilename} {your-local-file}