...
/Chapter Summary: Deploying Applications With Docker Stacks
Chapter Summary: Deploying Applications With Docker Stacks
Summary of the concepts covered in this chapter.
We'll cover the following...
Commands
Let's explore all the commands covered in this chapter:
docker stack deploy
is the command you’ll run to deploy and update stacks. You need to specify the name of the stack and the stack file. Docker expects the stack file to be calledcompose.yaml
by default.docker stack ls
lists all stacks on a swarm and shows the number of services each one has.docker stack ps
gives you detailed information about a stack. It tells you which nodes replicas are running on, which images they’re based on, and shows the desired state and current state of each service replica.docker stack rm
deletes a stack and doesn’t ask for confirmation.
Quick recap
Stacks are Docker’s native solution for running cloud-native microservices applications on Swarm clusters. They offer a simple declarative interface for managing the entire lifecycle of applications and infrastructure.
We start with application code and infrastructure requirements like networks, ports, volumes, and secrets. You containerize the application and combine all the services and infrastructure definitions into a single declarative stack file. You set the number of replicas and rollout and restart policies. Then, you use the
docker stack deploy
command to deploy the application from the stack file.We should also perform all updates declaratively by updating the stack file and redeploying the app.