Change binary name to docker-machine

Signed-off-by: Simon Thulbourn <simon+github@thulbourn.com>
This commit is contained in:
Simon Thulbourn 2015-01-22 18:05:52 +00:00
parent 29c1eb9080
commit 4ee78fa097
6 changed files with 141 additions and 141 deletions

View File

@ -4,6 +4,6 @@ RUN go get github.com/mitchellh/gox
RUN go get github.com/aktau/github-release
RUN go get github.com/tools/godep
ENV GOPATH /go/src/github.com/docker/machine/Godeps/_workspace:/go
ENV MACHINE_BINARY /go/src/github.com/docker/machine/machine
ENV MACHINE_BINARY /go/src/github.com/docker/machine/docker-machine
WORKDIR /go/src/github.com/docker/machine
ADD . /go/src/github.com/docker/machine

View File

@ -5,7 +5,7 @@ Machine makes it really easy to create Docker hosts on local hypervisors and clo
It works a bit like this:
```console
$ machine create -d virtualbox dev
$ docker-machine create -d virtualbox dev
[info] Downloading boot2docker...
[info] Creating SSH key...
[info] Creating VirtualBox VM...
@ -13,11 +13,11 @@ $ machine create -d virtualbox dev
[info] Waiting for VM to start...
[info] "dev" has been created and is now the active host. Docker commands will now run against that host.
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.100:2375
$ docker $(machine config dev) run busybox echo hello world
$ docker $(docker-machine config dev) run busybox echo hello world
Unable to find image 'busybox' locally
Pulling repository busybox
e72ac664f4f0: Download complete
@ -26,19 +26,19 @@ df7546f9f060: Download complete
e433a6c5b276: Download complete
hello world
$ machine create -d digitalocean --digitalocean-access-token=... staging
$ docker-machine create -d digitalocean --digitalocean-access-token=... staging
[info] Creating SSH key...
[info] Creating Digital Ocean droplet...
[info] Waiting for SSH...
[info] "staging" has been created and is now the active host. Docker commands will now run against that host.
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev virtualbox Running tcp://192.168.99.108:2376
staging * digitalocean Running tcp://104.236.37.134:2376
```
Machine creates Docker hosts that are secure by default. The connection between the client and daemon is encrypted and authenticated using TLS security. To get the Docker arguments for a machine use the command: `machine config <machine-name>` i.e. `machine config dev`.
Machine creates Docker hosts that are secure by default. The connection between the client and daemon is encrypted and authenticated using TLS security. To get the Docker arguments for a machine use the command: `docker-machine config <machine-name>` i.e. `docker-machine config dev`.
## Try it out
@ -58,7 +58,7 @@ Options:
### Digital Ocean
Creates machines on [Digital Ocean](https://www.digitalocean.com/). You need to create a personal access token under "Apps & API" in the Digital Ocean Control Panel and pass that to `machine create` with the `--digitalocean-access-token` option.
Creates machines on [Digital Ocean](https://www.digitalocean.com/). You need to create a personal access token under "Apps & API" in the Digital Ocean Control Panel and pass that to `docker-machine create` with the `--digitalocean-access-token` option.
Options:
@ -79,9 +79,9 @@ You need to create a subscription with a cert. Run these commands:
Go to the Azure portal, go to the "Settings" page, then "Manage Certificates" and upload `mycert.cer`.
Grab your subscription ID from the portal, then run `machine create` with these details:
Grab your subscription ID from the portal, then run `docker-machine create` with these details:
$ machine create -d azure --azure-subscription-id="SUB_ID" --azure-subscription-cert="mycert.pem"
$ docker-machine create -d azure --azure-subscription-id="SUB_ID" --azure-subscription-cert="mycert.pem"
Options:
@ -245,7 +245,7 @@ variable and CLI option are provided the CLI option takes the precedence.
Create machines on [Softlayer](http://softlayer.com).
You need to generate an API key in the softlayer control panel.
You need to generate an API key in the softlayer control panel.
[Retrieve your API key](http://knowledgelayer.softlayer.com/procedure/retrieve-your-api-key)
Options:

View File

@ -203,7 +203,7 @@ func cmdCreate(c *cli.Context) {
log.Infof("%q has been created and is now the active machine", name)
// TODO @ehazlett: this will likely change but at least show how to connect for now
log.Infof("To connect: docker $(machine config %s) ps", name)
log.Infof("To connect: docker $(%s config %s) ps", c.App.Name, name)
}
func cmdConfig(c *cli.Context) {

View File

@ -1,38 +1,38 @@
page_title: Working with Docker Machine
page_description: Working with Docker Machine
page_keywords: docker, machine, virtualbox, digitalocean, amazonec2
# Working with Docker Machine
## Overview
In order to run Docker containers, you must have a
[Docker daemon](https://docs.docker.com/arch) running somewhere. If youre on a
Linux system and you want to run a container on your local machine, this is
straightforward: you run the daemon on your local machine and communicate with
it over the Unix socket located at `/var/run/docker.sock` (this all happens
behind the scenes when you run `docker` on the command line). However, if you
want to control containers from Mac OSX / Windows or manage them on a remote
server, youll need to create a new machine (probably a virtual machine) with
Docker installed and execute Docker commands for that host remotely.
In order to run Docker containers, you must have a
[Docker daemon](https://docs.docker.com/arch) running somewhere. If youre on a
Linux system and you want to run a container on your local machine, this is
straightforward: you run the daemon on your local machine and communicate with
it over the Unix socket located at `/var/run/docker.sock` (this all happens
behind the scenes when you run `docker` on the command line). However, if you
want to control containers from Mac OSX / Windows or manage them on a remote
server, youll need to create a new machine (probably a virtual machine) with
Docker installed and execute Docker commands for that host remotely.
Traditionally, the way to do this was either:
- manual (open the web interface or virtualization application, make the machine
- manual (open the web interface or virtualization application, make the machine
yourself, manually install Docker, etc.) and therefore tedious and error-prone
- with existing automation technologies, which usually entail a quite high skill
- with existing automation technologies, which usually entail a quite high skill
threshold
Docker's [`machine`](https://github.com/docker/machine) is a tool for making the
process of creating and managing those machines (and running Docker commands
against them) much faster and easier for users. `machine` allows users to
quickly create running instances of the Docker daemon on local virtualization
platforms (e.g. Virtualbox) or on cloud providers (e.g. AWS EC2) that they can
Docker's [`docker-machine`](https://github.com/docker/machine) is a tool for making the
process of creating and managing those machines (and running Docker commands
against them) much faster and easier for users. `docker-machine` allows users to
quickly create running instances of the Docker daemon on local virtualization
platforms (e.g. Virtualbox) or on cloud providers (e.g. AWS EC2) that they can
connect to and control from their local Docker client binary.
## Installation
Docker Machine is supported on Windows, OSX, and Linux. To install Docker
Machine, download the appropriate binary for your OS and architecture to the
Docker Machine is supported on Windows, OSX, and Linux. To install Docker
Machine, download the appropriate binary for your OS and architecture to the
correct place in your `PATH`:
- [Windows - x86_64]()
@ -42,75 +42,75 @@ correct place in your `PATH`:
- [OSX - i386]()
- [Linux - i386]()
Now you should be able to check the version with `machine -v`:
Now you should be able to check the version with `docker-machine -v`:
```
$ machine -v
$ docker-machine -v
machine version 0.0.3
```
## Getting started with Docker Machine using a local VM
Let's take a look at using `machine` to creating, using, and managing a Docker
Let's take a look at using `docker-machine` to creating, using, and managing a Docker
host inside of [VirtualBox](ihttps://www.virtualbox.org/).
First, ensure that
[VirtualBox 4.3.20](https://www.virtualbox.org/wiki/Downloads) is correctly
installed on your system.
First, ensure that
[VirtualBox 4.3.20](https://www.virtualbox.org/wiki/Downloads) is correctly
installed on your system.
If you run the `machine ls` command to show all available machines, you will see
If you run the `docker-machine ls` command to show all available machines, you will see
that none have been created so far.
```
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
```
To create one, we run the `machine create` command, passing the string
`virtualbox` to the `--driver` flag. The final argument we pass is the name of
To create one, we run the `docker-machine create` command, passing the string
`virtualbox` to the `--driver` flag. The final argument we pass is the name of
the machine - in this case, we will name our machine "dev".
This will download a lightweight Linux distribution
([boot2docker](https://github.com/boot2docker/boot2docker)) with the Docker
This will download a lightweight Linux distribution
([boot2docker](https://github.com/boot2docker/boot2docker)) with the Docker
daemon installed, and will create and start a VirtualBox VM with Docker running.
```
$ machine create --driver virtualbox dev
$ docker-machine create --driver virtualbox dev
INFO[0000] Creating SSH key...
INFO[0000] Creating VirtualBox VM...
INFO[0007] Starting VirtualBox VM...
INFO[0007] Waiting for VM to start...
INFO[0038] "dev" has been created and is now the active machine
INFO[0038] To connect: docker $(machine config dev) ps
INFO[0038] To connect: docker $(docker-machine config dev) ps
```
You can see the machine you have created by running the `machine ls` command
You can see the machine you have created by running the `docker-machine ls` command
again:
```
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.100:2375
```
The `*` next to `dev` indicates that it is the active host.
Next, as noted in the output of the `machine create` command, we have to tell
Docker to talk to that machine. You can do this with the `machine config`
Next, as noted in the output of the `docker-machine create` command, we have to tell
Docker to talk to that machine. You can do this with the `docker-machine config`
command. For example,
```
$ docker $(machine config dev) ps
$ docker $(docker-machine config dev) ps
```
This will pass arguments to the Docker client that specify the TLS settings.
To see what will be passed, run `machine config dev`.
To see what will be passed, run `docker-machine config dev`.
You can now run Docker commands on this host:
```
$ docker $(machine config dev) run busybox echo hello world
$ docker $(docker-machine config dev) run busybox echo hello world
Unable to find image 'busybox' locally
Pulling repository busybox
e72ac664f4f0: Download complete
@ -120,68 +120,68 @@ e433a6c5b276: Download complete
hello world
```
Any exposed ports are available on the Docker hosts IP address, which you can
get using the `machine ip` command:
Any exposed ports are available on the Docker hosts IP address, which you can
get using the `docker-machine ip` command:
```
$ machine ip
$ docker-machine ip
192.168.99.100
```
Now you can manage as many local VMs running Docker as you please- just run
`machine create` again.
Now you can manage as many local VMs running Docker as you please- just run
`docker-machine create` again.
If you are finished using a host, you can stop it with `docker stop` and start
If you are finished using a host, you can stop it with `docker stop` and start
it again with `docker start`:
```
$ machine stop
$ machine start
$ docker-machine stop
$ docker-machine start
```
If they aren't passed any arguments, commands such as `machine stop` will run
against the active host (in this case, the VirtualBox VM). You can also specify
a host to run a command against as an argument. For instance, you could also
If they aren't passed any arguments, commands such as `docker-machine stop` will run
against the active host (in this case, the VirtualBox VM). You can also specify
a host to run a command against as an argument. For instance, you could also
have written:
```
$ machine stop dev
$ machine start dev
$ docker-machine stop dev
$ docker-machine start dev
```
## Using Docker Machine with a cloud provider
One of the nice things about `machine` is that it provides several “drivers”
which let you use the same interface to create hosts on many different cloud
platforms. This is accomplished by using the `machine create` command with the
`--driver` flag. Here we will be demonstrating the
[Digital Ocean](https://digitalocean.com) driver (called `digitalocean`), but
there are drivers included for several providers including Amazon Web Services,
One of the nice things about `docker-machine` is that it provides several “drivers”
which let you use the same interface to create hosts on many different cloud
platforms. This is accomplished by using the `docker-machine create` command with the
`--driver` flag. Here we will be demonstrating the
[Digital Ocean](https://digitalocean.com) driver (called `digitalocean`), but
there are drivers included for several providers including Amazon Web Services,
Google Compute Engine, and Microsoft Azure.
Usually it is required that you pass account verification credentials for these
providers as flags to `machine create`. These flags are unique for each driver.
For instance, to pass a Digital Ocean access token you use the
Usually it is required that you pass account verification credentials for these
providers as flags to `docker-machine create`. These flags are unique for each driver.
For instance, to pass a Digital Ocean access token you use the
`--digitalocean-access-token` flag.
Let's take a look at how to do this.
To generate your access token:
1. Go to the Digital Ocean administrator panel and click on "Apps and API" in
1. Go to the Digital Ocean administrator panel and click on "Apps and API" in
the side panel.
2. Click on "Generate New Token".
3. Give the token a clever name (e.g. "machine"), make sure the "Write" checkbox
3. Give the token a clever name (e.g. "machine"), make sure the "Write" checkbox
is checked, and click on "Generate Token".
4. Grab the big long hex string that is generated (this is your token) and store it somehwere safe.
Now, run `machine create` with the `digitalocean` driver and pass your key to
Now, run `docker-machine create` with the `digitalocean` driver and pass your key to
the `--digitalocean-access-token` flag.
Example:
```
$ machine create \
$ docker-machine create \
--driver digitalocean \
--digitalocean-access-token 0ab77166d407f479c6701652cee3a46830fef88b8199722b87821621736ab2d4 \
staging
@ -189,81 +189,81 @@ INFO[0000] Creating SSH key...
INFO[0000] Creating Digital Ocean droplet...
INFO[0002] Waiting for SSH...
INFO[0085] "staging" has been created and is now the active machine
INFO[0085] To connect: docker $(machine config dev) staging
INFO[0085] To connect: docker $(docker-machine config dev) staging
```
For convenience, `machine` will use sensible defaults for choosing settings such
as the image that the VPS is based on, but they can also be overridden using
their respective flags (e.g. `--digitalocean-image`). This is useful if, for
instance, you want to create a nice large instance with a lot of memory and CPUs
(by default `machine` creates a small VPS). For a full list of the
flags/settings available and their defaults, see the output of
`machine create -h`.
For convenience, `docker-machine` will use sensible defaults for choosing settings such
as the image that the VPS is based on, but they can also be overridden using
their respective flags (e.g. `--digitalocean-image`). This is useful if, for
instance, you want to create a nice large instance with a lot of memory and CPUs
(by default `docker-machine` creates a small VPS). For a full list of the
flags/settings available and their defaults, see the output of
`docker-machine create -h`.
When the creation of a host is initiated, a unique SSH key for accessing the
host (initially for provisioning, then directly later if the user runs the
`machine ssh` command) will be created automatically and stored in the client's
directory in `~/.docker/machines`. After the creation of the SSH key, Docker
will be installed on the remote machine and the daemon will be configured to
accept remote connections over TCP using TLS for authentication. Once this
When the creation of a host is initiated, a unique SSH key for accessing the
host (initially for provisioning, then directly later if the user runs the
`docker-machine ssh` command) will be created automatically and stored in the client's
directory in `~/.docker/machines`. After the creation of the SSH key, Docker
will be installed on the remote machine and the daemon will be configured to
accept remote connections over TCP using TLS for authentication. Once this
is finished, the host is ready for connection.
And then from this point, the remote host behaves much like the local host we
created in the last section. If we look at `machine`, well see it is now the
And then from this point, the remote host behaves much like the local host we
created in the last section. If we look at `docker-machine`, well see it is now the
active host:
```
$ machine active dev
$ machine ls
$ docker-machine active dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev virtualbox Running tcp://192.168.99.103:2375
staging * digitalocean Running tcp://104.236.50.118:2375
```
To select an active host, you can use the `machine active` command.
To select an active host, you can use the `docker-machine active` command.
```
$ machine active dev
$ machine ls
$ docker-machine active dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.103:2375
staging digitalocean Running tcp://104.236.50.118:2375
```
To remove a host and all of its containers and images, use `machine rm`:
To remove a host and all of its containers and images, use `docker-machine rm`:
```
$ machine rm dev staging
$ machine ls
$ docker-machine rm dev staging
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
```
## Adding a host without a driver
You can add a host to Docker which only has a URL and no driver. Therefore it
can be used an alias for an existing host so you dont have to type out the URL
You can add a host to Docker which only has a URL and no driver. Therefore it
can be used an alias for an existing host so you dont have to type out the URL
every time you run a Docker command.
```
$ machine create --url=tcp://50.134.234.20:2376 custombox
$ machine ls
$ docker-machine create --url=tcp://50.134.234.20:2376 custombox
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
custombox * none Running tcp://50.134.234.20:2376
```
## Subcommands
## Subcommands
#### active
Get or set the active machine.
```
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev virtualbox Running tcp://192.168.99.103:2375
staging * digitalocean Running tcp://104.236.50.118:2375
$ machine active dev
$ machine ls
$ docker-machine active dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.103:2375
staging digitalocean Running tcp://104.236.50.118:2375
@ -274,12 +274,12 @@ staging digitalocean Running tcp://104.236.50.118:2375
Create a machine.
```
$ machine create --driver virtualbox dev
$ docker-machine create --driver virtualbox dev
INFO[0000] Creating SSH key...
INFO[0000] Creating VirtualBox VM...
INFO[0007] Starting VirtualBox VM...
INFO[0007] Waiting for VM to start...
INFO[0038] "dev" has been created and is now the active machine. To point Docker at this machine, run: export DOCKER_HOST=$(machine url) DOCKER_AUTH=identity
INFO[0038] "dev" has been created and is now the active machine. To point Docker at this machine, run: export DOCKER_HOST=$(docker-machine url) DOCKER_AUTH=identity
```
#### config
@ -287,7 +287,7 @@ INFO[0038] "dev" has been created and is now the active machine. To point Docker
Show the Docker client configuration for a machine.
```
$ machine config dev
$ docker-machine config dev
--tls --tlscacert=/Users/ehazlett/.docker/machines/dev/ca.pem --tlscert=/Users/ehazlett/.docker/machines/dev/cert.pem --tlskey=/Users/ehazlett/.docker/machines/dev/key.pem -H tcp://192.168.99.103:2376
```
@ -296,7 +296,7 @@ $ machine config dev
Inspect information about a machine.
```
$ machine inspect dev
$ docker-machine inspect dev
{
"DriverName": "virtualbox",
"Driver": {
@ -318,7 +318,7 @@ Show help text.
Get the IP address of a machine.
```
$ machine ip
$ docker-machine ip
192.168.99.104
```
@ -327,11 +327,11 @@ $ machine ip
Kill (abruptly force stop) a machine.
```
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.104:2376
$ machine kill dev
$ machine ls
$ docker-machine kill dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Stopped
```
@ -341,7 +341,7 @@ dev * virtualbox Stopped
List machines.
```
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev virtualbox Stopped
foo0 virtualbox Running tcp://192.168.99.105:2376
@ -353,26 +353,26 @@ foo4 * virtualbox Running tcp://192.168.99.109:2376
#### restart
Restart a machine. Oftentimes this is equivalent to
`machine stop; machine start`.
Restart a machine. Oftentimes this is equivalent to
`docker-machine stop; machine start`.
```
$ machine restart
$ docker-machine restart
INFO[0005] Waiting for VM to start...
```
#### rm
Remove a machine. This will remove the local reference as well as delete it
Remove a machine. This will remove the local reference as well as delete it
on the cloud provider or virtualization management platform.
```
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
foo0 virtualbox Running tcp://192.168.99.105:2376
foo1 virtualbox Running tcp://192.168.99.106:2376
$ machine rm foo1
$ machine ls
$ docker-machine rm foo1
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
foo0 virtualbox Running tcp://192.168.99.105:2376
```
@ -382,9 +382,9 @@ foo0 virtualbox Running tcp://192.168.99.105:2376
Log into or run a command on a machine using SSH.
```
$ machine ssh -c "echo this process ran on a remote machine"
$ docker-machine ssh -c "echo this process ran on a remote machine"
this process ran on a remote machine
$ machine ssh
$ docker-machine ssh
## .
## ## ## ==
## ## ## ## ===
@ -409,7 +409,7 @@ bin/ etc/ init linuxrc opt/ root/ sbin/ tmp var/
Gracefully start a machine.
```
$ machine restart
$ docker-machine restart
INFO[0005] Waiting for VM to start...
```
@ -418,11 +418,11 @@ INFO[0005] Waiting for VM to start...
Gracefully stop a machine.
```
$ machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.104:2376
$ machine stop dev
$ machine ls
$ docker-machine stop dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Stopped
```
@ -432,7 +432,7 @@ dev * virtualbox Stopped
Upgrade a machine to the latest version of Docker.
```
$ machine upgrade dev
$ docker-machine upgrade dev
```
#### url
@ -440,13 +440,13 @@ $ machine upgrade dev
Get the URL of a host
```
$ machine url
$ docker-machine url
tcp://192.168.99.109:2376
```
## Driver Options
TODO: List all possible values (where applicable) for all flags for every
TODO: List all possible values (where applicable) for all flags for every
driver.
#### Amazon Web Services
@ -465,7 +465,7 @@ Options:
- `--amazonec2-zone`: The AWS zone launch the instance in (i.e. one of a,b,c,d,e).
#### Digital Ocean
Creates machines on [Digital Ocean](https://www.digitalocean.com/). You need to create a personal access token under "Apps & API" in the Digital Ocean Control Panel and pass that to `machine create` with the `--digitalocean-access-token` option.
Creates machines on [Digital Ocean](https://www.digitalocean.com/). You need to create a personal access token under "Apps & API" in the Digital Ocean Control Panel and pass that to `docker-machine create` with the `--digitalocean-access-token` option.
Options:
@ -491,7 +491,7 @@ Options:
Create machines on [Softlayer](http://softlayer.com).
You need to generate an API key in the softlayer control panel.
You need to generate an API key in the softlayer control panel.
[Retrieve your API key](http://knowledgelayer.softlayer.com/procedure/retrieve-your-api-key)
Options:
@ -521,9 +521,9 @@ You need to create a subscription with a cert. Run these commands:
Go to the Azure portal, go to the "Settings" page, then "Manage Certificates" and upload `mycert.cer`.
Grab your subscription ID from the portal, then run `machine create` with these details:
Grab your subscription ID from the portal, then run `docker-machine create` with these details:
$ machine create -d azure --azure-subscription-id="SUB_ID" --azure-subscription-cert="mycert.pem"
$ docker-machine create -d azure --azure-subscription-id="SUB_ID" --azure-subscription-cert="mycert.pem"
Options:

View File

@ -9,4 +9,4 @@ fi
rm -f machine_*
docker build -t docker-machine .
exec docker run --rm -v `pwd`:/go/src/github.com/docker/machine docker-machine gox "${OS_ARCH_ARG[@]}"
exec docker run --rm -v `pwd`:/go/src/github.com/docker/machine docker-machine gox "${OS_ARCH_ARG[@]}" -output="docker-machine_{{.OS}}-{{.Arch}}"

View File

@ -20,7 +20,7 @@ docker run --rm -e GITHUB_TOKEN docker-machine github-release release \
--name $VERSION \
--description "" \
--pre-release \
for BINARY in machine_*; do
for BINARY in docker-machine_*; do
docker run --rm -e GITHUB_TOKEN -v `pwd`:/go/src/github.com/docker/machine \
docker-machine github-release upload \
--user docker \