Merge pull request #1622 from rawkode/virtualbox-no-vbfs-share-flag

Added option to disable virtualbox vbfs mount of users home directory
This commit is contained in:
Nathan LeClaire 2015-08-12 13:25:18 -07:00
commit 49764bb47a
2 changed files with 13 additions and 4 deletions

View File

@ -13,7 +13,7 @@ Create machines locally using [VirtualBox](https://www.virtualbox.org/).
This driver requires VirtualBox to be installed on your host.
$ docker-machine create --driver=virtualbox vbox-test
You can create an entirely new machine or you can convert a Boot2Docker VM into
a machine by importing the VM. To convert a Boot2Docker VM, you'd use the following
command:
@ -29,6 +29,7 @@ Options:
- `--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-hostonly-cidr`: The CIDR of the host only adapter.
- `--virtualbox-no-share`: Disable the mount of your home directory
The `--virtualbox-boot2docker-url` flag takes a few different forms. By
default, if no value is specified for this flag, Machine will check locally for
@ -49,11 +50,11 @@ using the `http://` form.
To customize the host only adapter, you can use the `--virtualbox-hostonly-cidr`
flag. This will specify the host IP and Machine will calculate the VirtualBox
DHCP server address (a random IP on the subnet between `.1` and `.25`) so
DHCP server address (a random IP on the subnet between `.1` and `.25`) so
it does not clash with the specified host IP.
Machine will also specify the DHCP lower bound to `.100` and the upper bound
to `.254`. For example, a specified CIDR of `192.168.24.1/24` would have a
DHCP server between `192.168.24.2-25`, a lower bound of `192.168.24.100` and
DHCP server between `192.168.24.2-25`, a lower bound of `192.168.24.100` and
upper bound of `192.168.24.254`.
Environment variables and default values:
@ -66,3 +67,4 @@ Environment variables and default values:
| `--virtualbox-boot2docker-url` | `VIRTUALBOX_BOOT2DOCKER_URL` | *Latest boot2docker url* |
| `--virtualbox-import-boot2docker-vm` | - | `boot2docker-vm` |
| `--virtualbox-hostonly-cidr` | `VIRTUALBOX_HOSTONLY_CIDR` | `192.168.99.1/24` |
| `--virtualbox-no-share` | - | `false` |

View File

@ -43,6 +43,7 @@ type Driver struct {
Boot2DockerURL string
Boot2DockerImportVM string
HostOnlyCIDR string
NoShare bool
}
func init() {
@ -91,6 +92,10 @@ func GetCreateFlags() []cli.Flag {
Value: defaultHostOnlyCIDR,
EnvVar: "VIRTUALBOX_HOSTONLY_CIDR",
},
cli.BoolFlag{
Name: "virtualbox-no-share",
Usage: "Disable the mount of your home directory",
},
}
}
@ -137,6 +142,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.SSHUser = "docker"
d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm")
d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr")
d.NoShare = flags.Bool("virtualbox-no-share")
return nil
}
@ -307,7 +313,8 @@ func (d *Driver) Create() error {
// TODO "linux"
}
if shareDir != "" {
if shareDir != "" && !d.NoShare {
log.Debugf("setting up shareDir")
if _, err := os.Stat(shareDir); err != nil && !os.IsNotExist(err) {
return err
} else if !os.IsNotExist(err) {