Application and Database Together
For local development, Compose can run an application and database on a private network. The application connects to the database by service name, while only the application or reverse proxy needs a published host port.
In production, databases may be managed outside the application host to gain stronger backup, failover, monitoring, and operational capabilities.