You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 1, 2018. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+68-14
Original file line number
Diff line number
Diff line change
@@ -2,48 +2,60 @@
2
2
Boot2docker Vagrant box for optimized Docker and Docker Compose use on Mac and Windows.
3
3
4
4
## What is this?
5
-
This is a temporary solution to achive better performance with synced folders and docker data volumes on Mac and Windows.
5
+
This is a temporary solution to achieve better performance with synced folders and docker data volumes on Mac and Windows.
6
6
The stock boot2docker currently mounts host volumes via the default VirtualBox Guest Additions (vboxfs) mode, which is terribly slow. Much better performance can be achieved with NFS, SMB or rsync.
On Windows prerequisites are installed using **chocolatey** (chocolatey will be installed if missing).
26
+
27
+
1. Run Command Prompt as administrator
28
+
2. Copy and and paste there the code from [presetup-win.cmd](https://raw.githubusercontent.com/blinkreaction/boot2docker-vagrant/master/presetup-win.cmd)
29
+
14
30
<aname="setup"></a>
15
31
## Setup and usage
16
32
17
-
### Automatic installation (Mac only)
33
+
### Automatic installation (Mac and Windows)
18
34
19
-
The following tools will be installed: brew, cask, virtualbox, vagrant, docker, docker-compose.
20
-
In case you already have some of these installed (virtualbox, vagrant), it may be best (though not required) to either follow the manual install process or uninstall them before proceeding.
35
+
**On Windows** Git Bash is the recommended option to run console commands.
36
+
If you are having any issues, please check if they can be reproduced in Git Bash.
21
37
22
38
Run the following command within your `<Projects>` (shared boo2docker VM for multiple projects, recommended) or `<Project>` (dedicated boot2docker VM) directory:
**On Windows** Git Bash is the recommended option to run console commands.
29
-
If you are having any issues, please check if they can be reproduced in Git Bash.
42
+
### Manual installation (Mac and Windows)
30
43
31
44
1. Copy `Vagrantfile` and `vagrant.yml.dist` files from this repo into your `<Projects>` (shared boo2docker VM for multiple projects, recommended) or `<Project>` (dedicated boot2docker VM) directory.
32
45
2. Rename `vagrant.yml.dist` to `vagrant.yml`
33
-
3. Launch Git Bash
34
-
4. cd to `</path/to/project>`, start the VM and log into it
46
+
3. Launch Terminal (Mac) or Git Bash (Windows)
47
+
4. cd to `</path/to/project>`, start the VM
35
48
36
49
```
37
50
cd </path/to/project>
38
51
vagrant up
39
-
vagrant ssh
40
52
```
41
53
42
-
5. Verify installation (you are in the boot2docker VM at this point)
54
+
5. Verify installation
43
55
44
56
```
45
57
docker version
46
-
docker-compose --version
58
+
vagrant ssh -c 'docker-compose --version'
47
59
```
48
60
49
61
<a name="synced-folders"></a>
@@ -64,6 +76,8 @@ In addition to the stock SMB synced folders option this box provides an experime
64
76
With the **SMB2** option you will receive several "elevated command prompt" prompts which you accept.
65
77
No need to enter usernames and passwords unlike the stock SMB option Vagrant ships with.
66
78
79
+
If you use rsync, you'll have to run `vagrant rsync-auto` in a separate terminal to keep the files in sync as you make changes.
80
+
67
81
<a name="synced-folders-mac"></a>
68
82
### Mac
69
83
@@ -115,6 +129,7 @@ To use rsync on Windows:
115
129
2. Choose `rsync` as the sync type in the `vagrant.yml` file.
116
130
3. Provide an explicit list of folders to sync in the `vagrant.yml` file (`folders` sequence).
117
131
4. Reload the VM: `vagrant reload`
132
+
5. Run `vagrant rsync-auto` to keep the files in sync as you make changes.
118
133
119
134
<a name="vm-settings"></a>
120
135
## VirtualBox VM settings
@@ -142,6 +157,45 @@ hosts:
142
157
143
158
Project specific `<IP>:<port>` mapping for containers is done in via docker-compose in `docker-compose.yml`
144
159
160
+
# vhost-proxy
161
+
162
+
As an alternative to using dedicated IPs for different projects a built-in vhost-proxy container can be used.
163
+
It binds to `192.168.10.10:80` (the default box IP address) and routes web requests based on the `Host` header.
164
+
165
+
### How to use
166
+
- Set `vhost_proxy: true` in your vagrant.yml file and do a 'vagrant reload'
167
+
- Set the `VIRTUAL_HOST` environment variable for the web container in your setup (e.g. `VIRTUAL_HOST=example.com`)
168
+
- Add an entry in your hosts file (e.g. `/etc/hosts`) to point the domain to the default box IP (`192.168.10.10`)
169
+
170
+
Example docker run
171
+
172
+
```
173
+
docker run --name nginx -d -e "VIRTUAL_HOST=example.com" nginx:latest
174
+
```
175
+
176
+
Example docker-compose.yml entry
177
+
178
+
```
179
+
# Web node
180
+
web:
181
+
image: nginx:latest
182
+
ports:
183
+
- "80"
184
+
environment:
185
+
- VIRTUAL_HOST=example.com
186
+
```
187
+
188
+
Example hosts file entry
189
+
190
+
```
191
+
192.168.10.10 example.com
192
+
```
193
+
194
+
It is completely fine to use both the vhost-proxy approach and the dedicated IPs approach concurently:
195
+
-`"80"` - expose port "80", docker will randomly pick an available port on the Docker Host
0 commit comments