Docker Compose 是一个工具,用于使用单个 YAML 文件定义和运行多容器应用程序。与其手动运行多个 docker run 命令,不如在 docker-compose.yml 中描述所有服务(app、database、cache),然后用一个命令将它们全部启动。
Compose 解决的问题
A real app often has MULTIPLE containers: a web app + a database + a cache + ...
→ manually running each with docker run (ports, networks, volumes, env, dependencies)
is tedious, error-prone, and hard to reproduce/share
→ Compose defines the WHOLE stack in one file → start it all with one command.
