
Summary
Key points of this document
- Where are the design challenges?
- How to define boundaries
- Details that make a difference in implementation
Overview
Docker Compose is a powerful tool for setting up development environments, but incorrect configurations can lead to slow startups, reducing daily development speed. A division that considers both stability and speed is necessary. The speed of a development environment largely depends not on machine specifications, but on the boundary design for file synchronization, dependency installation, DB initialization, and hot reloading.
Where are the design challenges?
While convenient, Docker Compose, when always starting all services, leads to high memory consumption and long waiting times. Problems such as slow frontend file watching, APIs crashing before the DB starts, and initial data being corrupted every time can also occur.
Developers' OS and machine performance are not uniform. It's necessary to decide which parts should be fully unified on Docker and which parts run faster on the host. Especially for React and Vite development servers, running them on the host can sometimes be more comfortable.
Docker Compose can reduce environmental differences, but putting everything into containers slows down both startup and testing. Especially with a combination of Laravel, React, and MySQL, vendor, node_modules, DB data, and Vite's watch processes affect speed.
How to define boundaries
In Compose, focus on shared dependent services like DB, mail verification, and storage alternatives. Clearly state options in the README (API in container, frontend on host, or both in containers) and separate heavy services using profiles.
In design, separate parts that bring containers closer to production from parts that speed up the development experience. While synchronizing application code, move dependency directories to named volumes and make DB initialization an explicit command.
Details that make a difference in implementation
In Dockerfile, separate dependency installation and application code into layers,`node_modules`and clarify the handling of vendor. Set up health checks for the DB, and start the API after it's ready. Make initialization SQL, migrations, and seeds separate commands.
In Compose definitions, separate PHP, Node, DB, mail verification, object storage, etc., and use profiles to start only what's needed daily. Dockerfile caches the dependency installation layer to prevent rebuilding every time source changes.
- Exclude
node_modulesandvendorfrom host synchronization and keep them in container volumes. - Make DB migrations and seeds explicit
maketasks ornpmscripts, not automatic on startup. - Switch Vite and file watching polling settings per environment and check CPU usage.
Observe how it breaks
During validation, check initial startup time in a clean environment, subsequent startup times, hot reload speed, and DB recreation procedures. An important test is also whether a new developer can get started just by following the README.
During validation, measure initial setup time, subsequent startup times, hot reload time, and test execution time. Looking at numerical values instead of just feeling allows you to determine which volumes or monitoring settings are effective.
Discarded options and trade-offs
Allowing host execution increases environmental differences. Containerizing everything increases reproducibility but can decrease speed. It's realistic to prepare separate standard and high-speed procedures according to team priorities.
Using containers identical to production provides peace of mind, but can decrease development speed. Conversely, prioritizing speed by relying too much on host dependencies brings back environmental differences. It's necessary to adjust daily work speed and small production differences on separate axes.
Decision criteria to leave for the team
The purpose of a Docker Compose development environment is not to encapsulate everything. By fixing dependent services that require reproducibility and choosing a fast-moving form for parts touched daily, it becomes a continuously usable environment.
A Docker Compose development environment is not complete just because it runs. By designing for the speed of startup, change reflection, testing, and resetting, you can significantly reduce daily friction for the team.


