Merge pull request #343 from joaofnfernandes/machine-reference

Update code blocks in machine/reference
This commit is contained in:
Joao Fernandes 2016-10-25 14:01:27 -07:00 committed by GitHub
commit 9482ecaa40
20 changed files with 513 additions and 405 deletions

View File

@ -13,11 +13,16 @@ title: active
See which machine is "active" (a machine is considered active if the
`DOCKER_HOST` environment variable points to it).
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev - virtualbox Running tcp://192.168.99.103:2376
staging * digitalocean Running tcp://203.0.113.81:2376
$ echo $DOCKER_HOST
tcp://203.0.113.81:2376
$ docker-machine active
staging
```none
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev - virtualbox Running tcp://192.168.99.103:2376
staging * digitalocean Running tcp://203.0.113.81:2376
$ echo $DOCKER_HOST
tcp://203.0.113.81:2376
$ docker-machine active
staging
```

View File

@ -10,23 +10,26 @@ title: config
# config
Usage: docker-machine config [OPTIONS] [arg...]
```none
Usage: docker-machine config [OPTIONS] [arg...]
Print the connection config for machine
Print the connection config for machine
Description:
Description:
Argument is a machine name.
Options:
Options:
--swarm Display the Swarm config instead of the Docker daemon
```
For example:
$ docker-machine config dev
--tlsverify
--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
```none
$ docker-machine config dev \
--tlsverify \
--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
```

View File

@ -15,17 +15,19 @@ Create a machine. Requires the `--driver` flag to indicate which provider
(VirtualBox, DigitalOcean, AWS, etc.) the machine should be created on, and an
argument to indicate the name of the created machine.
$ docker-machine create --driver virtualbox dev
Creating CA: /home/username/.docker/machine/certs/ca.pem
Creating client certificate: /home/username/.docker/machine/certs/cert.pem
Image cache does not exist, creating it at /home/username/.docker/machine/cache...
No default boot2docker iso found locally, downloading the latest release...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.6.2/boot2docker.iso to /home/username/.docker/machine/cache/boot2docker.iso...
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev
```none
$ docker-machine create --driver virtualbox dev
Creating CA: /home/username/.docker/machine/certs/ca.pem
Creating client certificate: /home/username/.docker/machine/certs/cert.pem
Image cache does not exist, creating it at /home/username/.docker/machine/cache...
No default boot2docker iso found locally, downloading the latest release...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.6.2/boot2docker.iso to /home/username/.docker/machine/cache/boot2docker.iso...
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev
```
## Accessing driver-specific flags in the help text
@ -34,15 +36,16 @@ drivers. These largely control aspects of Machine's provisoning process
(including the creation of Docker Swarm containers) that the user may wish to
customize.
$ docker-machine create
Docker Machine Version: 0.5.0 (45e3688)
Usage: docker-machine create [OPTIONS] [arg...]
```none
$ docker-machine create
Docker Machine Version: 0.5.0 (45e3688)
Usage: docker-machine create [OPTIONS] [arg...]
Create a machine.
Create a machine.
Run 'docker-machine create --driver name' to include the create flags for that driver in the help text.
Run 'docker-machine create --driver name' to include the create flags for that driver in the help text.
Options:
Options:
--driver, -d "none" Driver to create machine with.
--engine-install-url "https://get.docker.com" Custom URL to use for engine installation [$MACHINE_DOCKER_INSTALL_URL]
@ -61,6 +64,7 @@ customize.
--swarm-host "tcp://0.0.0.0:3376" ip/socket to listen on for Swarm master
--swarm-addr addr to advertise for Swarm (default: detect and use the machine IP)
--swarm-experimental Enable Swarm experimental features
```
Additionally, drivers can specify flags that Machine can accept as part of their
plugin code. These allow users to customize the provider-specific parameters of
@ -70,14 +74,15 @@ geographical region (`--amazonec2-region us-west-1`), and so on.
To see the provider-specific flags, simply pass a value for `--driver` when
invoking the `create` help text.
$ docker-machine create --driver virtualbox --help
Usage: docker-machine create [OPTIONS] [arg...]
```none
$ docker-machine create --driver virtualbox --help
Usage: docker-machine create [OPTIONS] [arg...]
Create a machine.
Create a machine.
Run 'docker-machine create --driver name' to include the create flags for that driver in the help text.
Run 'docker-machine create --driver name' to include the create flags for that driver in the help text.
Options:
Options:
--driver, -d "none" Driver to create machine with.
--engine-env [--engine-env option --engine-env option] Specify environment variables to set in the engine
@ -107,6 +112,7 @@ invoking the `create` help text.
--virtualbox-import-boot2docker-vm The name of a Boot2Docker VM to import
--virtualbox-memory "1024" Size of memory for host in MB [$VIRTUALBOX_MEMORY_SIZE]
--virtualbox-no-share Disable the mount of your home directory
```
You may notice that some flags specify environment variables that they are
associated with as well (located to the far left hand side of the row). If
@ -137,12 +143,14 @@ filesystem has been created, and so on.
The following is an example usage:
$ docker-machine create -d virtualbox \
```none
$ docker-machine create -d virtualbox \
--engine-label foo=bar \
--engine-label spam=eggs \
--engine-storage-driver overlay \
--engine-insecure-registry registry.myco.com \
foobarmachine
```
This will create a virtual machine running locally in Virtualbox which uses the
`overlay` storage backend, has the key-value pairs `foo=bar` and `spam=eggs` as
@ -150,18 +158,20 @@ labels on the engine, and allows pushing / pulling from the insecure registry
located at `registry.myco.com`. You can verify much of this by inspecting the
output of `docker info`:
$ eval $(docker-machine env foobarmachine)
$ docker info
Containers: 0
Images: 0
Storage Driver: overlay
...
Name: foobarmachine
...
Labels:
```none
$ eval $(docker-machine env foobarmachine)
$ docker info
Containers: 0
Images: 0
Storage Driver: overlay
...
Name: foobarmachine
...
Labels:
foo=bar
spam=eggs
provider=virtualbox
```
The supported flags are as follows:
@ -181,10 +191,12 @@ for all containers, and always use the `syslog` [log
driver](/engine/reference/run.md#logging-drivers-log-driver) you
could run the following create command:
$ docker-machine create -d virtualbox \
```none
$ docker-machine create -d virtualbox \
--engine-opt dns=8.8.8.8 \
--engine-opt log-driver=syslog \
gdns
```
Additionally, Docker Machine supports a flag, `--engine-env`, which can be used to
specify arbitrary environment variables to be set within the engine with the syntax `--engine-env name=value`. For example, to specify that the engine should use `example.com` as the proxy server, you could run the following create command:
@ -217,13 +229,15 @@ you won't have to worry about it.
Example create:
$ docker-machine create -d virtualbox \
```none
$ docker-machine create -d virtualbox \
--swarm \
--swarm-master \
--swarm-discovery token://<token> \
--swarm-strategy binpack \
--swarm-opt heartbeat=5 \
upbeat
```
This will set the swarm scheduling strategy to "binpack" (pack in containers as
tightly as possible per host instead of spreading them out), and the "heartbeat"

View File

@ -13,37 +13,41 @@ title: env
Set environment variables to dictate that `docker` should run a command against
a particular machine.
$ docker-machine env --help
```none
$ docker-machine env --help
Usage: docker-machine env [OPTIONS] [arg...]
Usage: docker-machine env [OPTIONS] [arg...]
Display the commands to set up the environment for the Docker client
Display the commands to set up the environment for the Docker client
Description:
Description:
Argument is a machine name.
Options:
Options:
--swarm Display the Swarm config instead of the Docker daemon
--shell Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh], default is sh/bash
--unset, -u Unset variables instead of setting them
--no-proxy Add machine IP to NO_PROXY environment variable
```
`docker-machine env machinename` will print out `export` commands which can be
run in a subshell. Running `docker-machine env -u` will print `unset` commands
which reverse this effect.
$ env | grep DOCKER
$ eval "$(docker-machine env dev)"
$ env | grep DOCKER
DOCKER_HOST=tcp://192.168.99.101:2376
DOCKER_CERT_PATH=/Users/nathanleclaire/.docker/machines/.client
DOCKER_TLS_VERIFY=1
DOCKER_MACHINE_NAME=dev
$ # If you run a docker command, now it will run against that host.
$ eval "$(docker-machine env -u)"
$ env | grep DOCKER
$ # The environment variables have been unset.
```none
$ env | grep DOCKER
$ eval "$(docker-machine env dev)"
$ env | grep DOCKER
DOCKER_HOST=tcp://192.168.99.101:2376
DOCKER_CERT_PATH=/Users/nathanleclaire/.docker/machines/.client
DOCKER_TLS_VERIFY=1
DOCKER_MACHINE_NAME=dev
$ # If you run a docker command, now it will run against that host.
$ eval "$(docker-machine env -u)"
$ env | grep DOCKER
$ # The environment variables have been unset.
```
The output described above is intended for the shells `bash` and `zsh` (if
you're not sure which shell you're using, there's a very good possibility that
@ -55,12 +59,14 @@ If you are using `fish` and the `SHELL` environment variable is correctly set to
the path where `fish` is located, `docker-machine env name` will print out the
values in the format which `fish` expects:
set -x DOCKER_TLS_VERIFY 1;
set -x DOCKER_CERT_PATH "/Users/nathanleclaire/.docker/machine/machines/overlay";
set -x DOCKER_HOST tcp://192.168.99.102:2376;
set -x DOCKER_MACHINE_NAME overlay
# Run this command to configure your shell:
# eval "$(docker-machine env overlay)"
```none
set -x DOCKER_TLS_VERIFY 1;
set -x DOCKER_CERT_PATH "/Users/nathanleclaire/.docker/machine/machines/overlay";
set -x DOCKER_HOST tcp://192.168.99.102:2376;
set -x DOCKER_MACHINE_NAME overlay
# Run this command to configure your shell:
# eval "$(docker-machine env overlay)"
```
If you are on Windows and using either Powershell or `cmd.exe`, `docker-machine env`
Docker Machine should now detect your shell automatically. If the automagic detection does not work you
@ -68,22 +74,26 @@ If you are on Windows and using either Powershell or `cmd.exe`, `docker-machine
For Powershell:
$ docker-machine.exe env --shell powershell dev
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.101:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\captain\.docker\machine\machines\dev"
$Env:DOCKER_MACHINE_NAME = "dev"
# Run this command to configure your shell:
# docker-machine.exe env --shell=powershell dev | Invoke-Expression
```none
$ docker-machine.exe env --shell powershell dev
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.101:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\captain\.docker\machine\machines\dev"
$Env:DOCKER_MACHINE_NAME = "dev"
# Run this command to configure your shell:
# docker-machine.exe env --shell=powershell dev | Invoke-Expression
```
For `cmd.exe`:
$ docker-machine.exe env --shell cmd dev
set DOCKER_TLS_VERIFY=1
set DOCKER_HOST=tcp://192.168.99.101:2376
set DOCKER_CERT_PATH=C:\Users\captain\.docker\machine\machines\dev
set DOCKER_MACHINE_NAME=dev
# Run this command to configure your shell: copy and paste the above values into your command prompt
```none
$ docker-machine.exe env --shell cmd dev
set DOCKER_TLS_VERIFY=1
set DOCKER_HOST=tcp://192.168.99.101:2376
set DOCKER_CERT_PATH=C:\Users\captain\.docker\machine\machines\dev
set DOCKER_MACHINE_NAME=dev
# Run this command to configure your shell: copy and paste the above values into your command prompt
```
## Excluding the created machine from proxies
@ -95,14 +105,16 @@ This is useful when using `docker-machine` with a local VM provider (e.g.
`virtualbox` or `vmwarefusion`) in network environments where a HTTP proxy is
required for internet access.
$ docker-machine env --no-proxy default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.104:2376"
export DOCKER_CERT_PATH="/Users/databus23/.docker/machine/certs"
export DOCKER_MACHINE_NAME="default"
export NO_PROXY="192.168.99.104"
# Run this command to configure your shell:
# eval "$(docker-machine env default)"
```none
$ docker-machine env --no-proxy default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.104:2376"
export DOCKER_CERT_PATH="/Users/databus23/.docker/machine/certs"
export DOCKER_MACHINE_NAME="default"
export NO_PROXY="192.168.99.104"
# Run this command to configure your shell:
# eval "$(docker-machine env default)"
```
You may also want to visit the [documentation on setting `HTTP_PROXY` for the
created daemon using the `--engine-env` flag for `docker-machine

View File

@ -10,22 +10,26 @@ title: help
# help
Usage: docker-machine help [arg...]
```none
Usage: docker-machine help [arg...]
Shows a list of commands or help for one command
Shows a list of commands or help for one command
```
Usage: docker-machine help _subcommand_
For example:
$ docker-machine help config
Usage: docker-machine config [OPTIONS] [arg...]
```none
$ docker-machine help config
Usage: docker-machine config [OPTIONS] [arg...]
Print the connection config for machine
Print the connection config for machine
Description:
Description:
Argument is a machine name.
Options:
Options:
--swarm Display the Swarm config instead of the Docker daemon
```

View File

@ -11,15 +11,17 @@ title: inspect
# inspect
Usage: docker-machine inspect [OPTIONS] [arg...]
```none
Usage: docker-machine inspect [OPTIONS] [arg...]
Inspect information about a machine
Inspect information about a machine
Description:
Description:
Argument is a machine name.
Options:
Options:
--format, -f Format the output using the given go template.
```
By default, this will render information about a machine as JSON. If a format is
specified, the given template will be executed for each result.
@ -36,8 +38,10 @@ In addition to the `text/template` syntax, there are some additional functions,
This is the default usage of `inspect`.
$ docker-machine inspect dev
{
```none
$ docker-machine inspect dev
{
"DriverName": "virtualbox",
"Driver": {
"MachineName": "docker-host-128be8d287b2028316c0ad5714b90bcfc11f998056f2f790f7c1f43f3d1e6eda",
@ -48,34 +52,35 @@ This is the default usage of `inspect`.
"IPAddress": "192.168.5.99"
},
...
}
}
```
**Get a machine's IP address:**
For the most part, you can pick out any field from the JSON in a fairly
straightforward manner.
{% raw %}
$ docker-machine inspect --format='{{.Driver.IPAddress}}' dev
192.168.5.99
{% endraw %}
```none
$ docker-machine inspect --format='{{.Driver.IPAddress}}' dev
192.168.5.99
```
**Formatting details:**
If you want a subset of information formatted as JSON, you can use the `json`
function in the template.
{% raw %}
$ docker-machine inspect --format='{{json .Driver}}' dev-fusion
{"Boot2DockerURL":"","CPUS":8,"CPUs":8,"CaCertPath":"/Users/hairyhenderson/.docker/machine/certs/ca.pem","DiskSize":20000,"IPAddress":"172.16.62.129","ISO":"/Users/hairyhenderson/.docker/machine/machines/dev-fusion/boot2docker-1.5.0-GH747.iso","MachineName":"dev-fusion","Memory":1024,"PrivateKeyPath":"/Users/hairyhenderson/.docker/machine/certs/ca-key.pem","SSHPort":22,"SSHUser":"docker","SwarmDiscovery":"","SwarmHost":"tcp://0.0.0.0:3376","SwarmMaster":false}
{% endraw %}
```none
$ docker-machine inspect --format='{{json .Driver}}' dev-fusion
{"Boot2DockerURL":"","CPUS":8,"CPUs":8,"CaCertPath":"/Users/hairyhenderson/.docker/machine/certs/ca.pem","DiskSize":20000,"IPAddress":"172.16.62.129","ISO":"/Users/hairyhenderson/.docker/machine/machines/dev-fusion/boot2docker-1.5.0-GH747.iso","MachineName":"dev-fusion","Memory":1024,"PrivateKeyPath":"/Users/hairyhenderson/.docker/machine/certs/ca-key.pem","SSHPort":22,"SSHUser":"docker","SwarmDiscovery":"","SwarmHost":"tcp://0.0.0.0:3376","SwarmMaster":false}
```
While this is usable, it's not very human-readable. For this reason, there is
`prettyjson`:
{% raw %}
$ docker-machine inspect --format='{{prettyjson .Driver}}' dev-fusion
{
```
$ docker-machine inspect --format='{{prettyjson .Driver}}' dev-fusion
{
"Boot2DockerURL": "",
"CPUS": 8,
"CPUs": 8,
@ -91,5 +96,5 @@ While this is usable, it's not very human-readable. For this reason, there is
"SwarmDiscovery": "",
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmMaster": false
}
{% endraw %}
}
```

View File

@ -12,8 +12,11 @@ title: ip
Get the IP address of one or more machines.
$ docker-machine ip dev
192.168.99.104
$ docker-machine ip dev dev2
192.168.99.104
192.168.99.105
```none
$ docker-machine ip dev
192.168.99.104
$ docker-machine ip dev dev2
192.168.99.104
192.168.99.105
```

View File

@ -11,19 +11,23 @@ title: kill
# kill
Usage: docker-machine kill [arg...]
```none
Usage: docker-machine kill [arg...]
Kill (abruptly force stop) a machine
Kill (abruptly force stop) a machine
Description:
Description:
Argument(s) are one or more machine names.
```
For example:
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.104:2376
$ docker-machine kill dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Stopped
```none
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.104:2376
$ docker-machine kill dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Stopped
```

View File

@ -10,16 +10,18 @@ title: ls
# ls
Usage: docker-machine ls [OPTIONS] [arg...]
```none
Usage: docker-machine ls [OPTIONS] [arg...]
List machines
List machines
Options:
Options:
--quiet, -q Enable quiet mode
--filter [--filter option --filter option] Filter output based on conditions provided
--timeout, -t "10" Timeout in seconds, default to 10s
--format, -f Pretty-print machines using a Go template
```
## Timeout
@ -31,9 +33,11 @@ the -t flag for this purpose with a numerical value in seconds.
### Example
$ docker-machine ls -t 12
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
```none
$ docker-machine ls -t 12
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
```
## Filtering
@ -50,25 +54,27 @@ The currently supported filters are:
### Examples
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
dev - virtualbox Stopped
foo0 - virtualbox Running tcp://192.168.99.105:2376 v1.9.1
foo1 - virtualbox Running tcp://192.168.99.106:2376 v1.9.1
foo2 * virtualbox Running tcp://192.168.99.107:2376 v1.9.1
```none
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
dev - virtualbox Stopped
foo0 - virtualbox Running tcp://192.168.99.105:2376 v1.9.1
foo1 - virtualbox Running tcp://192.168.99.106:2376 v1.9.1
foo2 * virtualbox Running tcp://192.168.99.107:2376 v1.9.1
$ docker-machine ls --filter name=foo0
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
foo0 - virtualbox Running tcp://192.168.99.105:2376 v1.9.1
$ docker-machine ls --filter name=foo0
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
foo0 - virtualbox Running tcp://192.168.99.105:2376 v1.9.1
$ docker-machine ls --filter driver=virtualbox --filter state=Stopped
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
dev - virtualbox Stopped v1.9.1
$ docker-machine ls --filter driver=virtualbox --filter state=Stopped
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
dev - virtualbox Stopped v1.9.1
$ docker-machine ls --filter label=com.class.app=foo1 --filter label=com.class.app=foo2
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
foo1 - virtualbox Running tcp://192.168.99.105:2376 v1.9.1
foo2 * virtualbox Running tcp://192.168.99.107:2376 v1.9.1
$ docker-machine ls --filter label=com.class.app=foo1 --filter label=com.class.app=foo2
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
foo1 - virtualbox Running tcp://192.168.99.105:2376 v1.9.1
foo2 * virtualbox Running tcp://192.168.99.107:2376 v1.9.1
```
## Formatting
@ -77,7 +83,7 @@ The formatting option (`--format`) will pretty-print machines using a Go templat
Valid placeholders for the Go template are listed below:
| Placeholder | Description |
| -------------- | ---------------------------------------- |
|:---------------|:-----------------------------------------|
| .Name | Machine name |
| .Active | Is the machine active? |
| .ActiveHost | Is the machine an active non-swarm host? |
@ -96,17 +102,17 @@ when using the table directive, will include column headers as well.
The following example uses a template without headers and outputs the `Name` and `Driver` entries separated by a colon
for all running machines:
{% raw %}
$ docker-machine ls --format "{{.Name}}: {{.DriverName}}"
default: virtualbox
ec2: amazonec2
{% endraw %}
```none
$ docker-machine ls --format "{{.Name}}: {{.DriverName}}"
default: virtualbox
ec2: amazonec2
```
To list all machine names with their driver in a table format you can use:
{% raw %}
$ docker-machine ls --format "table {{.Name}} {{.DriverName}}"
NAME DRIVER
default virtualbox
ec2 amazonec2
{% endraw %}
```none
$ docker-machine ls --format "table {{.Name}} {{.DriverName}}"
NAME DRIVER
default virtualbox
ec2 amazonec2
```

View File

@ -19,10 +19,13 @@ originally specified Swarm or Engine configuration).
Usage is `docker-machine provision [name]`. Multiple names may be specified.
$ docker-machine provision foo bar
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
```none
$ docker-machine provision foo bar
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
```
The Machine provisioning process will:

View File

@ -10,21 +10,26 @@ title: regenerate-certs
# regenerate-certs
Usage: docker-machine regenerate-certs [OPTIONS] [arg...]
```none
Usage: docker-machine regenerate-certs [OPTIONS] [arg...]
Regenerate TLS Certificates for a machine
Regenerate TLS Certificates for a machine
Description:
Description:
Argument(s) are one or more machine names.
Options:
Options:
--force, -f Force rebuild and do not prompt
```
Regenerate TLS certificates and update the machine with new certs.
For example:
$ docker-machine regenerate-certs dev
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
```none
$ docker-machine regenerate-certs dev
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
```

View File

@ -11,16 +11,20 @@ title: restart
# restart
Usage: docker-machine restart [arg...]
```none
Usage: docker-machine restart [arg...]
Restart a machine
Restart a machine
Description:
Description:
Argument(s) are one or more machine names.
```
Restart a machine. Oftentimes this is equivalent to
`docker-machine stop; docker-machine start`. But some cloud driver try to implement a clever restart which keeps the same
ip address.
$ docker-machine restart dev
Waiting for VM to start...
```
$ docker-machine restart dev
Waiting for VM to start...
```

View File

@ -14,54 +14,58 @@ title: rm
Remove a machine. This will remove the local reference as well as delete it
on the cloud provider or virtualization management platform.
$ docker-machine rm --help
```none
$ docker-machine rm --help
Usage: docker-machine rm [OPTIONS] [arg...]
Usage: docker-machine rm [OPTIONS] [arg...]
Remove a machine
Remove a machine
Description:
Description:
Argument(s) are one or more machine names.
Options:
Options:
--force, -f Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)
-y Assumes automatic yes to proceed with remove, without prompting further user confirmation
```
## Examples
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
bar - virtualbox Running tcp://192.168.99.101:2376 v1.9.1
baz - virtualbox Running tcp://192.168.99.103:2376 v1.9.1
foo - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
qix - virtualbox Running tcp://192.168.99.102:2376 v1.9.1
```none
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
bar - virtualbox Running tcp://192.168.99.101:2376 v1.9.1
baz - virtualbox Running tcp://192.168.99.103:2376 v1.9.1
foo - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
qix - virtualbox Running tcp://192.168.99.102:2376 v1.9.1
$ docker-machine rm baz
About to remove baz
Are you sure? (y/n): y
Successfully removed baz
$ docker-machine rm baz
About to remove baz
Are you sure? (y/n): y
Successfully removed baz
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
bar - virtualbox Running tcp://192.168.99.101:2376 v1.9.1
foo - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
qix - virtualbox Running tcp://192.168.99.102:2376 v1.9.1
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
bar - virtualbox Running tcp://192.168.99.101:2376 v1.9.1
foo - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
qix - virtualbox Running tcp://192.168.99.102:2376 v1.9.1
$ docker-machine rm bar qix
About to remove bar, qix
Are you sure? (y/n): y
Successfully removed bar
Successfully removed qix
$ docker-machine rm bar qix
About to remove bar, qix
Are you sure? (y/n): y
Successfully removed bar
Successfully removed qix
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
foo - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
foo - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
$ docker-machine rm -y foo
About to remove foo
Successfully removed foo
$ docker-machine rm -y foo
About to remove foo
Successfully removed foo
```

View File

@ -18,15 +18,17 @@ machine's case, you don't have to specify the name, just the path.
Consider the following example:
$ cat foo.txt
cat: foo.txt: No such file or directory
$ docker-machine ssh dev pwd
/home/docker
$ docker-machine ssh dev 'echo A file created remotely! >foo.txt'
$ docker-machine scp dev:/home/docker/foo.txt .
foo.txt 100% 28 0.0KB/s 00:00
$ cat foo.txt
A file created remotely!
```none
$ cat foo.txt
cat: foo.txt: No such file or directory
$ docker-machine ssh dev pwd
/home/docker
$ docker-machine ssh dev 'echo A file created remotely! >foo.txt'
$ docker-machine scp dev:/home/docker/foo.txt .
foo.txt 100% 28 0.0KB/s 00:00
$ cat foo.txt
A file created remotely!
```
Just like how `scp` has a `-r` flag for copying files recursively,
`docker-machine` has a `-r` flag for this feature.

View File

@ -14,7 +14,8 @@ Log into or run a command on a machine using SSH.
To login, just run `docker-machine ssh machinename`:
$ docker-machine ssh dev
```none
$ docker-machine ssh dev
## .
## ## ## ==
## ## ## ## ===
@ -24,35 +25,43 @@ To login, just run `docker-machine ssh machinename`:
\ \ __/
\____\______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.4.0, build master : 69cf398 - Fri Dec 12 01:39:42 UTC 2014
docker@boot2docker:~$ ls /
Users/ dev/ home/ lib/ mnt/ proc/ run/ sys/ usr/
bin/ etc/ init linuxrc opt/ root/ sbin/ tmp var/
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.4.0, build master : 69cf398 - Fri Dec 12 01:39:42 UTC 2014
docker@boot2docker:~$ ls /
Users/ dev/ home/ lib/ mnt/ proc/ run/ sys/ usr/
bin/ etc/ init linuxrc opt/ root/ sbin/ tmp var/
```
You can also specify commands to run remotely by appending them directly to the
`docker-machine ssh` command, much like the regular `ssh` program works:
$ docker-machine ssh dev free
total used free shared buffers
Mem: 1023556 183136 840420 0 30920
-/+ buffers: 152216 871340
Swap: 1212036 0 1212036
```none
$ docker-machine ssh dev free
total used free shared buffers
Mem: 1023556 183136 840420 0 30920
-/+ buffers: 152216 871340
Swap: 1212036 0 1212036
```
Commands with flags will work as well:
$ docker-machine ssh dev df -h
Filesystem Size Used Available Use% Mounted on
rootfs 899.6M 85.9M 813.7M 10% /
tmpfs 899.6M 85.9M 813.7M 10% /
tmpfs 499.8M 0 499.8M 0% /dev/shm
/dev/sda1 18.2G 58.2M 17.2G 0% /mnt/sda1
cgroup 499.8M 0 499.8M 0% /sys/fs/cgroup
/dev/sda1 18.2G 58.2M 17.2G 0%
/mnt/sda1/var/lib/docker/aufs
```none
$ docker-machine ssh dev df -h
Filesystem Size Used Available Use% Mounted on
rootfs 899.6M 85.9M 813.7M 10% /
tmpfs 899.6M 85.9M 813.7M 10% /
tmpfs 499.8M 0 499.8M 0% /dev/shm
/dev/sda1 18.2G 58.2M 17.2G 0% /mnt/sda1
cgroup 499.8M 0 499.8M 0% /sys/fs/cgroup
/dev/sda1 18.2G 58.2M 17.2G 0%
/mnt/sda1/var/lib/docker/aufs
```
If you are using the "external" SSH type as detailed in the next section, you
can include additional arguments to pass through to the `ssh` binary in the
@ -61,7 +70,9 @@ the command generated by Docker Machine). For instance, the following command
will forward port 8080 from the `default` machine to `localhost` on your host
computer:
$ docker-machine ssh default -L 8080:localhost:8080
```bash
$ docker-machine ssh default -L 8080:localhost:8080
```
## Different types of SSH
@ -80,7 +91,9 @@ and Docker Machine will act sensibly out of the box. However, if you
deliberately want to use the Go native version, you can do so with a global
command line flag / environment variable like so:
$ docker-machine --native-ssh ssh dev
```bash
$ docker-machine --native-ssh ssh dev
```
There are some variations in behavior between the two methods, so please report
any issues or inconsistencies if you come across them.

View File

@ -11,14 +11,19 @@ title: start
# start
Usage: docker-machine start [arg...]
```none
Usage: docker-machine start [arg...]
Start a machine
Start a machine
Description:
Description:
Argument(s) are one or more machine names.
```
For example:
$ docker-machine start dev
Starting VM...
```none
$ docker-machine start dev
Starting VM...
```

View File

@ -10,14 +10,18 @@ title: status
# status
Usage: docker-machine status [arg...]
```none
Usage: docker-machine status [arg...]
Get the status of a machine
Get the status of a machine
Description:
Description:
Argument is a machine name.
```
For example:
$ docker-machine status dev
Running
```
$ docker-machine status dev
Running
```

View File

@ -11,19 +11,26 @@ title: stop
# stop
Usage: docker-machine stop [arg...]
```none
Usage: docker-machine stop [arg...]
Gracefully Stop a machine
Gracefully Stop a machine
Description:
Description:
Argument(s) are one or more machine names.
```
For example:
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.104:2376
$ docker-machine stop dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Stopped
```none
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Running tcp://192.168.99.104:2376
$ docker-machine stop dev
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev * virtualbox Stopped
```

View File

@ -20,12 +20,15 @@ example, if the machine uses boot2docker for its OS, this command will download
the latest boot2docker ISO and replace the machine's existing ISO with the
latest.
$ docker-machine upgrade default
Stopping machine to do the upgrade...
Upgrading machine default...
Downloading latest boot2docker release to /home/username/.docker/machine/cache/boot2docker.iso...
Starting machine back up...
Waiting for VM to start...
```none
$ docker-machine upgrade default
Stopping machine to do the upgrade...
Upgrading machine default...
Downloading latest boot2docker release to /home/username/.docker/machine/cache/boot2docker.iso...
Starting machine back up...
Waiting for VM to start...
```
> **Note**: If you are using a custom boot2docker ISO specified using
> `--virtualbox-boot2docker-url` or an equivalent flag, running an upgrade on

View File

@ -12,5 +12,7 @@ title: url
Get the URL of a host
$ docker-machine url dev
tcp://192.168.99.109:2376
```none
$ docker-machine url dev
tcp://192.168.99.109:2376
```