diff --git a/get-started/part3.md b/get-started/part3.md index 5a23362769..be6fc0bba3 100644 --- a/get-started/part3.md +++ b/get-started/part3.md @@ -231,14 +231,26 @@ started. ### Take down the app and the swarm -Take the app down with `docker stack rm`: +* Take the app down with `docker stack rm`: -```shell -docker stack rm getstartedlab -``` + ```shell + docker stack rm getstartedlab + ``` -This removes the app, but our one-node swarm is still up and running (as shown -by `docker node ls`). Take down the swarm with `docker swarm leave --force`. + This removes the app, but our one-node swarm is still up and running + (as shown by `docker node ls`). + +* Take down the swarm. + + ``` + docker swarm leave --force + ``` + + This removes the swarm. The purpose of this is to have a clean slate + in preparation for the next steps, where you create a swarm on + virtual "Docker machines" starting from the same command shell. + This way, there'll be no confusion as to which Dockerized host you are + using or which swarm you are working with. It's as easy as that to stand up and scale your app with Docker. You've taken a huge step towards learning how to run containers in production. Up next, you @@ -274,4 +286,5 @@ docker service ps # List tasks associated with an app docker inspect # Inspect task or container docker container ls -q # List container IDs docker stack rm # Tear down an application +docker swarm leave --force # Take down a single node swarm from the manager ``` diff --git a/get-started/part4.md b/get-started/part4.md index 785e2b4910..acbd543299 100644 --- a/get-started/part4.md +++ b/get-started/part4.md @@ -515,7 +515,7 @@ which kept load-balancing requests across containers, even though they were running on different machines. Finally, you learned how to iterate and scale your app on a cluster. -Here are some commands you might like to run to interact with your swarm a bit: +Here are some commands you might like to run to interact with your swarm and your VMs a bit: ```shell docker-machine create --driver virtualbox myvm1 # Create a VM (Mac, Win7, Linux) @@ -525,11 +525,18 @@ docker-machine ssh myvm1 "docker node ls" # List the nodes in your swarm docker-machine ssh myvm1 "docker node inspect " # Inspect a node docker-machine ssh myvm1 "docker swarm join-token -q worker" # View join token docker-machine ssh myvm1 # Open an SSH session with the VM; type "exit" to end +docker node ls # View nodes in swarm (while logged on to manager) docker-machine ssh myvm2 "docker swarm leave" # Make the worker leave the swarm docker-machine ssh myvm1 "docker swarm leave -f" # Make master leave, kill swarm +docker-machine ls # list VMs, asterisk shows which VM this shell is talking to docker-machine start myvm1 # Start a VM that is currently not running +docker-machine env myvm1 # show environment variables and command for myvm1 +eval $(docker-machine env myvm1) # Mac command to connect shell to myvm1 +& "C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe" env myvm1 | Invoke-Expression # Windows command to connect shell to myvm1 +docker stack deploy -c # Deploy an app; command shell must be set to talk to manager (myvm1), uses local Compose file +docker-machine scp docker-compose.yml myvm1:~ # Copy file to node's home dir (only required if you use ssh to connect to manager and deploy the app) +docker-machine ssh myvm1 "docker stack deploy -c " # Deploy an app using ssh (you must have first copied the Compose file to myvm1) +eval $(docker-machine env -u) # Disconnect shell from VMs, use native docker docker-machine stop $(docker-machine ls -q) # Stop all running VMs docker-machine rm $(docker-machine ls -q) # Delete all VMs and their disk images -docker-machine scp docker-compose.yml myvm1:~ # Copy file to node's home dir -docker-machine ssh myvm1 "docker stack deploy -c " # Deploy an app ```