mirror of https://github.com/docker/docs.git
Merge pull request #1735 from praveen12bnitt/1733-virtualbox-network-tuning
added support for configuring nictype and nicpromise mode in virtualbox
This commit is contained in:
commit
52dc5734a7
|
@ -29,6 +29,8 @@ Options:
|
||||||
- `--virtualbox-boot2docker-url`: The URL of the boot2docker image. Defaults to the latest available version.
|
- `--virtualbox-boot2docker-url`: The URL of the boot2docker image. Defaults to the latest available version.
|
||||||
- `--virtualbox-import-boot2docker-vm`: The name of a Boot2Docker VM to import.
|
- `--virtualbox-import-boot2docker-vm`: The name of a Boot2Docker VM to import.
|
||||||
- `--virtualbox-hostonly-cidr`: The CIDR of the host only adapter.
|
- `--virtualbox-hostonly-cidr`: The CIDR of the host only adapter.
|
||||||
|
- `--virtualbox-hostonly-nictype`: Host Only Network Adapter Type. Possible values are are '82540EM' (Intel PRO/1000), 'Am79C973' (PCnet-FAST III) and 'virtio-net' Paravirtualized network adapter.
|
||||||
|
- `--virtualbox-hostonly-nicpromisc`: Host Only Network Adapter Promiscuous Mode. Possible options are deny , allow-vms, allow-all
|
||||||
- `--virtualbox-no-share`: Disable the mount of your home directory
|
- `--virtualbox-no-share`: Disable the mount of your home directory
|
||||||
|
|
||||||
The `--virtualbox-boot2docker-url` flag takes a few different forms. By
|
The `--virtualbox-boot2docker-url` flag takes a few different forms. By
|
||||||
|
@ -59,12 +61,14 @@ upper bound of `192.168.24.254`.
|
||||||
|
|
||||||
Environment variables and default values:
|
Environment variables and default values:
|
||||||
|
|
||||||
| CLI option | Environment variable | Default |
|
| CLI option | Environment variable | Default |
|
||||||
|--------------------------------------|------------------------------|--------------------------|
|
|--------------------------------------|-----------------------------------|--------------------------|
|
||||||
| `--virtualbox-memory` | `VIRTUALBOX_MEMORY_SIZE` | `1024` |
|
| `--virtualbox-memory` | `VIRTUALBOX_MEMORY_SIZE` | `1024` |
|
||||||
| `--virtualbox-cpu-count` | `VIRTUALBOX_CPU_COUNT` | `1` |
|
| `--virtualbox-cpu-count` | `VIRTUALBOX_CPU_COUNT` | `1` |
|
||||||
| `--virtualbox-disk-size` | `VIRTUALBOX_DISK_SIZE` | `20000` |
|
| `--virtualbox-disk-size` | `VIRTUALBOX_DISK_SIZE` | `20000` |
|
||||||
| `--virtualbox-boot2docker-url` | `VIRTUALBOX_BOOT2DOCKER_URL` | *Latest boot2docker url* |
|
| `--virtualbox-boot2docker-url` | `VIRTUALBOX_BOOT2DOCKER_URL` | *Latest boot2docker url* |
|
||||||
| `--virtualbox-import-boot2docker-vm` | - | `boot2docker-vm` |
|
| `--virtualbox-import-boot2docker-vm` | - | `boot2docker-vm` |
|
||||||
| `--virtualbox-hostonly-cidr` | `VIRTUALBOX_HOSTONLY_CIDR` | `192.168.99.1/24` |
|
| `--virtualbox-hostonly-cidr` | `VIRTUALBOX_HOSTONLY_CIDR` | `192.168.99.1/24` |
|
||||||
| `--virtualbox-no-share` | - | `false` |
|
| `--virtualbox-hostonly-nictype` | `VIRTUALBOX_HOSTONLY_NIC_TYPE` | `82540EM` |
|
||||||
|
| `--virtualbox-hostonly-nicpromisc` | `VIRTUALBOX_HOSTONLY_NIC_PROMISC` | `deny` |
|
||||||
|
| `--virtualbox-no-share` | - | `false` |
|
||||||
|
|
|
@ -29,6 +29,8 @@ import (
|
||||||
const (
|
const (
|
||||||
isoFilename = "boot2docker.iso"
|
isoFilename = "boot2docker.iso"
|
||||||
defaultHostOnlyCIDR = "192.168.99.1/24"
|
defaultHostOnlyCIDR = "192.168.99.1/24"
|
||||||
|
defaultNictype = "82540EM"
|
||||||
|
defaultNicpromisc = "deny"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -43,6 +45,8 @@ type Driver struct {
|
||||||
Boot2DockerURL string
|
Boot2DockerURL string
|
||||||
Boot2DockerImportVM string
|
Boot2DockerImportVM string
|
||||||
HostOnlyCIDR string
|
HostOnlyCIDR string
|
||||||
|
HostOnlyNicType string
|
||||||
|
HostOnlyPromiscMode string
|
||||||
NoShare bool
|
NoShare bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +96,18 @@ func GetCreateFlags() []cli.Flag {
|
||||||
Value: defaultHostOnlyCIDR,
|
Value: defaultHostOnlyCIDR,
|
||||||
EnvVar: "VIRTUALBOX_HOSTONLY_CIDR",
|
EnvVar: "VIRTUALBOX_HOSTONLY_CIDR",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "virtualbox-hostonly-nictype",
|
||||||
|
Usage: "Specify the Host Only Network Adapter Type",
|
||||||
|
Value: defaultNictype,
|
||||||
|
EnvVar: "VIRTUALBOX_HOSTONLY_NIC_TYPE",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "virtualbox-hostonly-nicpromisc",
|
||||||
|
Usage: "Specify the Host Only Network Adapter Promiscuous Mode",
|
||||||
|
Value: defaultNicpromisc,
|
||||||
|
EnvVar: "VIRTUALBOX_HOSTONLY_NIC_PROMISC",
|
||||||
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "virtualbox-no-share",
|
Name: "virtualbox-no-share",
|
||||||
Usage: "Disable the mount of your home directory",
|
Usage: "Disable the mount of your home directory",
|
||||||
|
@ -142,6 +158,8 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||||
d.SSHUser = "docker"
|
d.SSHUser = "docker"
|
||||||
d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm")
|
d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm")
|
||||||
d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr")
|
d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr")
|
||||||
|
d.HostOnlyNicType = flags.String("virtualbox-hostonly-nictype")
|
||||||
|
d.HostOnlyPromiscMode = flags.String("virtualbox-hostonly-nicpromisc")
|
||||||
d.NoShare = flags.Bool("virtualbox-no-share")
|
d.NoShare = flags.Bool("virtualbox-no-share")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -624,7 +642,8 @@ func (d *Driver) setupHostOnlyNetwork(machineName string) error {
|
||||||
|
|
||||||
if err := vbm("modifyvm", machineName,
|
if err := vbm("modifyvm", machineName,
|
||||||
"--nic2", "hostonly",
|
"--nic2", "hostonly",
|
||||||
"--nictype2", "82540EM",
|
"--nictype2", d.HostOnlyNicType,
|
||||||
|
"--nicpromisc2", d.HostOnlyPromiscMode,
|
||||||
"--hostonlyadapter2", hostOnlyNetwork.Name,
|
"--hostonlyadapter2", hostOnlyNetwork.Name,
|
||||||
"--cableconnected2", "on"); err != nil {
|
"--cableconnected2", "on"); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue