Stacks Flashcards
1
Q
What is a stack?
A
A stack is a group of interrelated services that share dependencies, and can be orchestrated and scaled together.
2
Q
Give an example of how to persist data between deployment of the stacks
A
ex. redis: image: redis ports: - "6379:6739" volumes: - ./data:/data deploy: placement: constraints: [node.role == manager] networks: - webnet
- redis always runs on the manager, so it’s always using the same filesystem.
- redis accesses an arbitrary directory in the host’s file system as /data inside the container, which is where Redis stores data. (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.)