Skip to content

Commit 410ed46

Browse files
Stop gap measure to fix data persistence part of the tutorial (docker#4725)
* stop gap measure to fix data persistence part of the tutorial Signed-off-by: Victoria Bialas <victoria.bialas@docker.com> * improved note about data directory and scp Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
1 parent fda20d9 commit 410ed46

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

get-started/part4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ more, see the [Docker Machine getting started topics](/machine/get-started.md#cr
372372
the VM but doesn't give you immediate access to files on your local host.
373373
>
374374
> * On Mac and Linux, you can use `docker-machine scp <file> <machine>:~`
375-
to copy files across machines, but Windows users need a terminal emulator
375+
to copy files across machines, but Windows users need a Linux terminal emulator
376376
like [Git Bash](https://git-for-windows.github.io/){: target="_blank" class="_"} in order for this to work.
377377
>
378378
> This tutorial demos both `docker-machine ssh` and

get-started/part5.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ with the following. Be sure to replace `username/repo:tag` with your image detai
8585
visualizer:
8686
image: dockersamples/visualizer:stable
8787
ports:
88-
- "8080:8080"
88+
- "8080:8080":
8989
volumes:
9090
- "/var/run/docker.sock:/var/run/docker.sock"
9191
deploy:
@@ -107,12 +107,24 @@ with the following. Be sure to replace `username/repo:tag` with your image detai
107107

108108
We'll talk more about placement constraints and volumes in a moment.
109109

110-
2. Make sure your shell is configured to talk to `myvm1` (examples are [here](part4.md#configure-a-docker-machine-shell-to-the-swarm-manager)).
110+
2. Make sure your shell is configured to talk to `myvm1` (full examples are [here](part4.md#configure-a-docker-machine-shell-to-the-swarm-manager)).
111111

112112
* Run `docker-machine ls` to list machines and make sure you are connected to `myvm1`, as indicated by an asterisk next it.
113113

114114
* If needed, re-run `docker-machine env myvm1`, then run the given command to configure the shell.
115115

116+
On **Mac or Linux** the command is:
117+
118+
```shell
119+
eval $(docker-machine env myvm1)
120+
```
121+
122+
On **Windows** the command is:
123+
124+
```shell
125+
& "C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe" env myvm1 | Invoke-Expression
126+
```
127+
116128
3. Re-run the `docker stack deploy` command on the manager, and
117129
whatever services need updating will be updated:
118130

@@ -189,6 +201,7 @@ Redis service. Be sure to replace `username/repo:tag` with your image details.
189201
deploy:
190202
placement:
191203
constraints: [node.role == manager]
204+
command: redis-server --appendonly yes
192205
networks:
193206
- webnet
194207
networks:
@@ -219,10 +232,7 @@ Redis service. Be sure to replace `username/repo:tag` with your image details.
219232
220233
- The placement constraint you put on the Redis service, ensuring that it
221234
always uses the same host.
222-
- The volume you created that lets the container access `./data` (on the host)
223-
as `/data` (inside the Redis container). While containers come and go, the
224-
files stored on `./data` on the specified host will persist, enabling
225-
continuity.
235+
- The volume you created that lets the container access `./data` (on the host) as `/data` (inside the Redis container). While containers come and go, the files stored on `./data` on the specified host will persist, enabling continuity.
226236
227237
You are ready to deploy your new Redis-using stack.
228238
@@ -232,16 +242,23 @@ Redis service. Be sure to replace `username/repo:tag` with your image details.
232242
docker-machine ssh myvm1 "mkdir ./data"
233243
```
234244
235-
3. Make sure your shell is configured to talk to `myvm1` (examples are [here](part4.md#configure-a-docker-machine-shell-to-the-swarm-manager)).
245+
3. This time, we need to copy over the new `docker-compose.yml` file with `docker-machine scp`:
236246
237-
* Run `docker-machine ls` to list machines and make sure you are connected to `myvm1`, as indicated by an asterisk next it.
247+
```shell
248+
$ docker-machine scp docker-compose.yml myvm1:~
249+
```
238250
239-
* If needed, re-run `docker-machine env myvm1`, then run the given command to configure the shell.
251+
> **Note**: Windows users will need a Linux terminal emulator like [Git
252+
Bash](https://git-for-windows.github.io/){: target="_blank" class="_"} in order
253+
for `docker-machine scp` to work. We are researching a better solution here, one
254+
without the need to copy files over to the VM, but for now it seems that the
255+
Compose file needs to be located on the VM so that it looks for `./data` in the
256+
right place.
240257
241-
4. Run `docker stack deploy` one more time.
258+
4. Run `docker stack deploy` one more time, this time wrapped in `docker-machine ssh myvm1` to specifically send it to the Compose file we just placed on the manager.
242259
243260
```shell
244-
docker stack deploy -c docker-compose.yml getstartedlab
261+
$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml getstartedlab"
245262
```
246263
247264
5. Check the web page at one of your nodes (e.g. `http://192.168.99.101`) and you'll see the results of the visitor counter, which is now live and storing information on Redis.

0 commit comments

Comments
 (0)