docker_practice/machine/usage.md

150 lines
4.5 KiB
Go
Raw Normal View History

2015-05-08 20:10:34 +08:00
## 使
2015-07-16 15:34:54 +08:00
2017-12-03 18:26:10 +08:00
Docker Machine
2015-07-16 15:34:54 +08:00
2017-12-03 18:26:10 +08:00
###
2015-07-16 15:34:54 +08:00
2017-12-03 18:26:10 +08:00
#### Virtualbox
2017-12-03 14:33:46 +08:00
2017-11-23 01:22:25 +08:00
使 `virtualbox` Docker test
```bash
2017-11-23 01:22:25 +08:00
$ docker-machine create -d virtualbox test
2015-07-16 15:34:54 +08:00
```
2017-12-03 14:33:46 +08:00
Docker
`--engine-opt dns=114.114.114.114` Docker DNS
`--engine-registry-mirror https://registry.docker-cn.com` Docker
`--virtualbox-memory 2048`
`--virtualbox-cpu-count 2` CPU
使 `docker-machine create --driver virtualbox --help`
#### macOS xhyve
`xhyve` GitHub: https://github.com/zchee/docker-machine-driver-xhyve
[`xhyve`](https://github.com/mist64/xhyve) 是 macOS 上轻量化的虚拟引擎,使用其创建的 Docker Machine 较 `VirtualBox` 驱动创建的运行效率要高。
```bash
$ brew install docker-machine-driver-xhyve
$ docker-machine create \
-d xhyve \
# --xhyve-boot2docker-url ~/.docker/machine/cache/boot2docker.iso \
--engine-opt dns=114.114.114.114 \
--engine-registry-mirror https://registry.docker-cn.com \
--xhyve-memory-size 2048 \
--xhyve-rawdisk \
--xhyve-cpu-count 2 \
xhyve
```
> `--xhyve-boot2docker-url ~/.docker/machine/cache/boot2docker.iso` GitHub ISO
使 `docker-machine create --driver xhyve --help`
2017-12-03 18:26:10 +08:00
#### Windows 10
2017-12-03 14:33:46 +08:00
Windows 10 Docker for Windows VirtualBox使 `virtualbox` Docker Machine使 `hyperv`
> `Hyper-V` **** 使 `--hyperv-virtual-switch=MY_SWITCH`
2017-12-03 14:33:46 +08:00
```bash
$ docker-machine create --driver hyperv --hyperv-virtual-switch=MY_SWITCH vm
2017-12-03 14:33:46 +08:00
```
使 `docker-machine create --driver hyperv --help`
2017-12-03 18:26:10 +08:00
### 使
2017-12-03 14:33:46 +08:00
2017-11-23 01:22:25 +08:00
```bash
$ docker-machine ls
2017-11-23 01:29:38 +08:00
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
test - virtualbox Running tcp://192.168.99.187:2376 v17.10.0-ce
2017-11-23 01:22:25 +08:00
```
`env`
```bash
2015-07-16 15:34:54 +08:00
$ docker-machine env test
```
2017-11-23 01:22:25 +08:00
test
`SSH`
```bash
$ docker-machine ssh test
docker@test:~$ docker --version
Docker version 17.10.0-ce, build f4ffd25
```
2017-12-03 14:33:46 +08:00
使 Docker
2017-11-23 01:35:38 +08:00
###
2017-11-23 01:22:25 +08:00
2015-07-16 15:34:54 +08:00
`-d`
2017-11-23 01:22:25 +08:00
2015-07-16 15:34:54 +08:00
* amazonec2
* azure
* digitalocean
* exoscale
* generic
* google
2017-12-03 14:33:46 +08:00
* hyperv
2015-07-16 15:34:54 +08:00
* none
* openstack
* rackspace
* softlayer
* virtualbox
* vmwarevcloudair
2017-12-03 14:33:46 +08:00
* vmwarefusion
2015-07-16 15:34:54 +08:00
* vmwarevsphere
2017-11-23 01:35:38 +08:00
###
[](https://github.com/docker/docker.github.io/blob/master/machine/AVAILABLE_DRIVER_PLUGINS.md) 查看
2015-07-16 15:34:54 +08:00
###
2017-11-23 01:22:25 +08:00
2015-07-16 15:34:54 +08:00
* `active` Docker
* `config`
* `create` Docker
* `env`
* `inspect`
* `ip`
* `kill`
* `ls`
2017-11-23 01:22:25 +08:00
* `provision`
2015-07-16 15:34:54 +08:00
* `regenerate-certs` TLS
* `restart`
* `rm`
* `ssh` SSH
* `scp`
2017-11-23 01:22:25 +08:00
* `mount`
2015-07-16 15:34:54 +08:00
* `start`
2017-11-23 01:22:25 +08:00
* `status`
2015-07-16 15:34:54 +08:00
* `stop`
* `upgrade` Docker
* `url` URL
2017-11-23 01:22:25 +08:00
* `version` docker-machine
* `help`
2015-07-16 15:34:54 +08:00
2017-11-23 01:22:25 +08:00
```bash
2017-11-23 01:27:16 +08:00
$ docker-machine COMMAND --help
2015-07-16 15:34:54 +08:00
```
2017-12-03 14:33:46 +08:00
2015-07-16 15:34:54 +08:00