Chapter Summary

This lesson is a summary of the contents learned in this chapter.

Stacks are the native Docker solution for deploying and managing cloud-native microservices applications with multiple services. They’re baked into the Docker engine and offer a simple declarative interface for deploying and managing the entire lifecycle of an application.

You start with application code and a set of infrastructure requirements — things like networks, ports, volumes, and secrets. You containerize the application and group together all of the app services and infrastructure requirements into a single declarative stack file. You set the number of replicas, as well as rolling update and restart policies. You then take the file and deploy the application from it using the docker stack deploy command.

Future updates to the deployed app should be done declaratively by checking the stack file out of source control, updating it, re-deploying the app, and checking the stack file back into source control.

Because the stack file defines things like the number of service replicas, you should maintain separate stack files for each of your environments, such as dev, test, and prod.

Get hands-on with 1200+ tech skills courses.