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
Copy file name to clipboardExpand all lines: doc/01-docker-machine/readme.md
+69-5Lines changed: 69 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ The toolbox installs a handful of tools on your local Windows or Mac OS X comput
16
16
17
17
Open a terminal on your computer.
18
18
19
-
Create and run a VM named `default`:
19
+
Create and run a VM named `default` using the following command:
20
20
21
21
```
22
22
docker-machine create -d virtualbox default
@@ -28,8 +28,7 @@ You can list the existing docker-machines:
28
28
docker-machine ls
29
29
```
30
30
31
-
32
-
Start the VM named `default`:
31
+
In case you already had the machine created, you can simply start the VM:
33
32
34
33
```
35
34
docker-machine start default
@@ -41,7 +40,7 @@ Now, let's use the docker-machine we've just created. We want to run the `hello-
41
40
42
41
If you use Mac, you need to run:
43
42
```
44
-
eval $(dockermachine env default)
43
+
eval $(docker-machine env default)
45
44
```
46
45
47
46
This command set the `DOCKER_HOST` variable to the IP of your `default``docker-machine`.
@@ -51,7 +50,6 @@ Then we can run the `hello-world` container:
51
50
docker run hello-world
52
51
```
53
52
54
-
55
53
## Clean up
56
54
57
55
After we tested our `default``docker-machine` we want to remove it from our computer.
@@ -68,6 +66,72 @@ You can destroy the VM named `default`:
68
66
docker-machine rm default
69
67
```
70
68
69
+
## Create two machines
70
+
71
+
To create two machines do:
72
+
73
+
```
74
+
docker-machine create -d virtualbox client1
75
+
docker-machine create -d virtualbox client2
76
+
```
77
+
78
+
Now you can see the machines with:
79
+
80
+
```
81
+
docker-machine ls
82
+
```
83
+
84
+
## Run Nginx on client1
85
+
86
+
```
87
+
eval $(docker-machine env client1)
88
+
docker run -d -p 80:80 nginx:1.8-alpine
89
+
docker-machine ip client1
90
+
open "http://$(docker-machine ip client1)"
91
+
```
92
+
93
+
## Run Nginx on client2
94
+
95
+
```
96
+
eval $(docker-machine env client2)
97
+
docker run -d -p 80:80 nginx:1.8-alpine
98
+
docker-machine ip client2
99
+
open "http://$(docker-machine ip client2)"
100
+
```
101
+
102
+
## SSH to machine
103
+
104
+
To SSH inside a machine:
105
+
106
+
```
107
+
docker-machine ssh client1
108
+
```
109
+
110
+
## Environment variables
111
+
112
+
Docker client is configured by environment variables to connect with remote daemons. The following command outputs the variables for connecting to previously created `default` VM.
0 commit comments