edited screen snap breaking out topics for Docker Cloud swarm mode added another where-to-next link added more where-to-next links added back in on-page TOC for create swarm topic incorporated Ryan's review comments on first draft more Ryan's review comments, sweep thru all for consistency, notoc on short pages, etc. removed duplicate link to 'create a new swarm in docker cloud' Laura's comments incorporated re-organized Cloud topics, added in Swarm Mode Ryan's review comments on Cloud, added new type of advisory for Beta previews more review comments, manage infrastructure --> standard mode fixing image testing cloud images updates to Cloud welcome page for Swarm, non-Swarm descriptions add new cloud repository image retake of corrupted image fixed the other instance of corrupted image by referencing the retake fixing corrupted image on GitHub Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
2.3 KiB
description, keywords, redirect_from, title, notoc
| description | keywords | redirect_from | title | notoc | |
|---|---|---|---|---|---|
| Stackfiles for your service | Python, service, stack |
|
Stackfiles for your service | true |
A stack is a logical grouping of related services that are usually deployed together and require each other to work as intended. If you are familiar with fig or Docker Compose then you should feel right at home with stacks. You can learn more about stacks here.
Stack files are YAML files, and you can learn more about the available syntax here. You can also interact with stacks using the stack commands in our API.
Service definitions in the stack file
The services that you created in this tutorial form a stack with three services: the load-balancer, the web application and the redis cache.
Look at the file called docker-cloud.yml in your quickstart to see the stack
file that defines the three services (lb, web, redis) you created in the
previous steps, including all modifications and environment variables.
This is what the docker-cloud.yml file looks like. (If you are using the
quickstart-go version, you'll see quickstart-go instead of
quickstart-python.)
lb:
image: dockercloud/haproxy
autorestart: always
links:
- web
ports:
- "80:80"
roles:
- global
web:
image: dockercloud/quickstart-python
autorestart: always
links:
- redis
environment:
- NAME=Friendly Users
deployment_strategy: high_availability
target_num_containers: 4
redis:
image: redis
autorestart: always
environment:
- REDIS_PASS=password
- REDIS_APPENDONLY=yes
- REDIS_APPENDFSYNC=always
You can use this stack file to quickly deploy this cluster of three services to another set of nodes. You can also edit the file to change the configuration.
Run a stack
To create the services in a stack file you use the simple stack up command.
You can run this in the path containing your stackfile (docker-cloud.yml), like so:
$ docker-cloud stack up
Or you can specify the YML file to use and its location:
$ docker-cloud up -f /usr/dockercloud/quickstart-python/docker-cloud.yml
What's Next?
Next, we'll do some Data management with Volumes