Skip to content

Commit 309adeb

Browse files
Merge pull request docker#1982 from londoncalling/vote-tutorial-feedback
feedback on PowerShell env setup, clarified env vs. ssh
2 parents c623d90 + c3d60c1 commit 309adeb

File tree

2 files changed

+45
-12
lines changed

2 files changed

+45
-12
lines changed

engine/getstarted-voting-app/node-setup.md

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ run some basic commmands to interact with the machines.
1818
[Docker Machine](/machine/get-started.md) (`docker-machine`), which
1919
comes auto-installed with both Docker for Mac and Docker for Windows.
2020

21+
<p />
22+
2123
* **VirtualBox driver on Docker for Mac** - On Docker for Mac, you'll
2224
use `docker-machine` with the `virtualbox` driver to create machines. If you had
2325
a legacy installation of Docker Toolbox, you already have Oracle VirtualBox
@@ -29,7 +31,7 @@ using the Toolbox installer because it can
2931
here](https://www.virtualbox.org/wiki/Downloads), and follow install
3032
instructions. You do not need to start VirtualBox. The `docker-machine create`
3133
command will call it via the driver.
32-
34+
<p />
3335
* **Hyper-V driver on Docker for Windows** - On Docker for Windows, you
3436
will use `docker-machine` with the [`Hyper-V`](/machine/drivers/hyper-v/) driver
3537
to create machines. You will need to follow the instructions in the [Hyper-V
@@ -40,7 +42,8 @@ in an elevated PowerShell per those instructions.
4042

4143
### Commands to create machines
4244

43-
The Docker Machine commands to create local virtual machines on Mac and Windows are are as follows. The rest of the `docker-machine` commands are the same on both.
45+
The Docker Machine commands to create local virtual machines on Mac and Windows
46+
are are as follows.
4447

4548
#### Mac
4649

@@ -118,11 +121,20 @@ You will need the IP address of the manager for a later step.
118121

119122
## Interacting with the machines
120123

121-
There are several ways to interact with these machines directly on the command line or programatically. We'll cover two methods for managing the machines directly from the command line:
124+
There are a few ways to interact with these machines directly on the command
125+
line or programatically. We'll cover two methods for managing the machines
126+
directly from the command line:
127+
128+
* [Manage the machines from a pre-configured shell](#manage-the-machines-from-a-pre-configured-shell)
129+
130+
* [`docker ssh` into a machine](#ssh-into-a-machine)
122131

123132
#### Manage the machines from a pre-configured shell
124133

125-
You can use `docker-machine` to set up environment variables in a shell that connect to the Docker client on a virtual machine. With this setup, the Docker commands you type in your local shell will run on the given machine. We'll set up a shell to talk to our manager machine.
134+
You can use `docker-machine` to set up environment variables in a shell that
135+
connect to the Docker client on a virtual machine. With this setup, the Docker
136+
commands you type in your local shell will run on the given machine. As an
137+
example, we'll set up a shell to talk to our manager machine.
126138

127139
1. Run `docker-machine env manager` to get environment variables for the manager.
128140

@@ -138,15 +150,22 @@ You can use `docker-machine` to set up environment variables in a shell that con
138150
```
139151
140152
2. Connect your shell to the manager.
153+
154+
On Mac:
155+
141156
```
142157
$ eval $(docker-machine env manager)
143158
```
144159
145-
This sets environment variables for the current shell that the Docker client will read which specify the TLS settings.
160+
On Windows PowerShell:
146161
147-
**Note**: If you are using `fish`, or a Windows shell such as
148-
Powershell/`cmd.exe` the above method will not work as described.
149-
Instead, see the [env command reference documentation](/machine/reference/env.md) to learn how to set the environment variables for your shell.
162+
```
163+
& docker-machine.exe env manager | Invoke-Expression
164+
```
165+
166+
This sets [environment variables](/machine/reference/env.md) for the current
167+
shell. The rest of the `docker-machine` commands we cover are the same on both
168+
Mac and Windows.
150169
151170
3. Run `docker-machine ls` again.
152171
@@ -157,11 +176,19 @@ You can use `docker-machine` to set up environment variables in a shell that con
157176
worker - virtualbox Running tcp://192.168.99.101:2376 v1.13.0-rc6
158177
```
159178
160-
The asterisk next `manager` indicates that the current shell is connected to that machine. Docker commands run in this shell will execute on the `manager.` (Note that you could change this by re-running the above commands to connect to the `worker`, or open multiple terminals to talk to multiple machines.)
179+
The asterisk next `manager` indicates that the current shell is connected to
180+
that machine. Docker commands run in this shell will execute on the `manager.`
181+
(Note that you could change this by re-running the above commands to connect to
182+
the `worker`, or open multiple terminals to talk to multiple machines.)
183+
184+
If you use this method, you'll need to re-configure the environment setup each
185+
time you want to switch between the manager and the worker, or keep two shells
186+
open.
161187
162188
#### ssh into a machine
163189
164-
You can use the command `docker-machine ssh <MACHINE-NAME>` to log into a machine:
190+
Alternatively, you can use the command `docker-machine ssh <MACHINE-NAME>` to
191+
log into a machine.
165192
166193
```
167194
$ docker-machine ssh manager
@@ -185,7 +212,13 @@ Boot2Docker version 1.13.0-rc6, build HEAD : 5ab2289 - Wed Jan 11 23:37:52 UTC 2
185212
Docker version 1.13.0-rc6, build 2f2d055
186213
```
187214
188-
We'll use this method later in the example.
215+
You _do not_ have to set up `docker-machine` environment variables, as in the
216+
previous section, for `docker ssh` to work. You can run this command in that
217+
same shell you configured to talk to the manager, or in a new one, and it will
218+
work either way.
219+
220+
This tutorial will employ the `docker ssh` method to run commands on the
221+
machines, but which approach you use is really a matter of personal preference.
189222
190223
## What's next?
191224

engine/getstarted-voting-app/test-drive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Click on either cats or dogs to vote.
2020

2121
## View the results tally
2222

23-
Now, go to `<MANAGER-IP:>5001` in a web browser to view the voting results tally, as one might do in the role of poll coordinator. The tally is shown by percentage in the current configuration of the app.
23+
Now, go to `MANAGER-IP:5001` in a web browser to view the voting results tally, as one might do in the role of poll coordinator. The tally is shown by percentage in the current configuration of the app.
2424

2525
![Results web page](images/vote-results.png)
2626

0 commit comments

Comments
 (0)