Merge pull request #2780 from jeanlaurent/enhance-ls-doc

Enhance ls doc
This commit is contained in:
David Gageot 2016-01-08 17:01:48 +01:00
commit ce057076ce
4 changed files with 94 additions and 34 deletions

View File

@ -13,6 +13,22 @@ parent="smn_machine_subcmds"
Set environment variables to dictate that `docker` should run a command against
a particular machine.
$ docker-machine env --help
Usage: docker-machine env [OPTIONS] [arg...]
Display the commands to set up the environment for the Docker client
Description:
Argument is a machine name.
Options:
--swarm Display the Swarm config instead of the Docker daemon
--shell Force environment to be configured for a specified shell: [fish, cmd, powershell], 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.
@ -32,7 +48,8 @@ which reverse this effect.
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
it's `bash`). However, these are not the only shells which Docker Machine
supports.
supports. Depending of the environment you're running your command into we will print them for the proper system.
We support `bash`, `cmd`, `powershell` and `emacs`.
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
@ -45,10 +62,9 @@ values in the format which `fish` expects:
# Run this command to configure your shell:
# eval "$(docker-machine env overlay)"
If you are on Windows and using Powershell or `cmd.exe`, `docker-machine env`
cannot detect your shell automatically, but it does have support for these
shells. In order to use them, specify which shell you would like to print the
options for using the `--shell` flag for `docker-machine env`.
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
can still override it using the `--shell` flag for `docker-machine env`.
For Powershell:

View File

@ -33,7 +33,7 @@ the -t flag for this purpose with a numerical value in seconds.
$ docker-machine ls -t 12
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 v1.9.0
default - virtualbox Running tcp://192.168.99.100:2376 v1.9.1
## Filtering
@ -48,6 +48,28 @@ The currently supported filters are:
- name (Machine name returned by driver, supports [golang style](https://github.com/google/re2/wiki/Syntax) regular expressions)
- label (Machine created with `--engine-label` option, can be filtered with `label=<key>[=<value>]`)
### 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
$ 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 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
The formatting option (`--format`) will pretty-print machines using a Go template.
@ -83,21 +105,3 @@ To list all machine names with their driver in a table format you can use:
NAME DRIVER
default virtualbox
ec2 amazonec2
## Examples
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev - virtualbox Stopped
foo0 - virtualbox Running tcp://192.168.99.105:2376
foo1 - virtualbox Running tcp://192.168.99.106:2376
foo2 * virtualbox Running tcp://192.168.99.107:2376
$ docker-machine ls --filter driver=virtualbox --filter state=Stopped
NAME ACTIVE DRIVER STATE URL SWARM
dev - virtualbox Stopped
$ docker-machine ls --filter label=com.class.app=foo1 --filter label=com.class.app=foo2
NAME ACTIVE DRIVER STATE URL
foo1 - virtualbox Running tcp://192.168.99.105:2376
foo2 * virtualbox Running tcp://192.168.99.107:2376

View File

@ -12,7 +12,8 @@ parent="smn_machine_subcmds"
# restart
Restart a machine. Oftentimes this is equivalent to
`docker-machine stop; docker-machine start`.
`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...

View File

@ -14,15 +14,54 @@ parent="smn_machine_subcmds"
Remove a machine. This will remove the local reference as well as delete it
on the cloud provider or virtualization management platform.
$ 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
$ docker-machine rm --help
$ docker-machine rm foo1
Do you really want to remove "foo1"? (y/n): y
Successfully removed foo1
Usage: docker-machine rm [OPTIONS] [arg...]
Remove a machine
Description:
Argument(s) are one or more machine names.
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 DRIVER STATE URL
foo0 - virtualbox Running tcp://192.168.99.105:2376
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 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 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