Docker - docker-machine
Table of Contents
About
Docker Machine is a command line client that lets you
- manage your Docker host (virtual host or machine)
- and install Docker Engine on them.
You can use Machine to create Docker hosts:
- on your local Mac or Windows box,
- on your company network, in your data center,
- or on cloud providers like AWS or Digital Ocean.
See docker/machine
You can use Docker Machine to:
- Install and run Docker on Mac or Windows
- Provision and manage multiple remote Docker hosts
- Provision Swarm clusters
Docker Machine uses Boot2Docker to initialise, start, stop and delete the VirtualBox's VM right from the command line.
Articles Related
Management
List your machines.
$ docker-machine ls
- On my machine
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default virtualbox Timeout
- From the doc:
NAME ACTIVE DRIVER STATE URL SWARM
dev * virtualbox Running tcp://192.168.99.100:2376
my-docker-machine virtualbox Stopped
default virtualbox Stopped
Important: If you are using Docker for Mac or Docker for Windows, you can skip this step.
Create your machine
If you are using Docker for Mac or Docker for Windows, you can skip this step.
Example:
docker-machine create \
--driver virtualbox \
--virtualbox-memory 8192 \
--virtualbox-disk-size "40960" \
default
Modify the configuration
docker-machine stop
VBoxManage modifyvm default --cpus 2
VBoxManage modifyvm default --memory 8192
docker-machine start
Ssh
docker-machine ssh
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.12.3, build HEAD : 7fc7575 - Thu Oct 27 17:23:17 UTC 2016
Docker version 1.12.3, build 6b644ec
[email protected]:~$ exit
Remove machine
$ docker-machine rm my-docker-machine
Successfully removed my-docker-machine
Environment
Docker - Host Environment ( OS )
docker-machine env default
# In cmder, see it as cmd but you can ask the output format with the shell argument
docker-machine env default -shell bash
Output:
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\gerard\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i
IP
docker-machine ip
192.168.99.100
Metadata Location
On Windows, all the metadata (disk, config) are stored at:
C:\Users\user\.docker\machine\machines\machineName
# Example
C:\Users\gerard\.docker\machine\machines\default