Honestly, I used to hate setting up a local dev environment directly on my laptop. Installing PHP, tweaking MySQL configs, plus dealing with weird port conflicts always turned my OS into a messy sandbox.
Once I switched to Docker, my coding workflow became much cleaner and simpler.
How I Think About Docker
Forget the heavy technical jargon. Here is how I mentally picture it:
- Isolated Boxes: Docker keeps each service inside a separate, lightweight container. PHP has its own box, MySQL has its own box. Your main laptop OS stays completely clean and untouched.
- No Version Conflicts: Need PHP 8.3 for this project, but another project still uses an older version? You can run both at the same time without breaking your system environment variables.
- One-Command Setup: Instead of manually configuring PHP and MySQL, Docker Compose links everything together. Just one command (
docker compose up -d), and the whole stack is up and running.
From there, I started feeling much more comfortable using Docker. Everything required is isolated without needing to manually install multiple versions, making the workflow far more efficient. With Docker, moving a finished project to another laptop or server is also way easier.
On top of that, all projects are isolated inside a WSL (Windows Subsystem for Linux) environment—think of it like having a small Linux machine inside Windows/OS. This makes managing personal projects much easier, keeping things organized and my laptop free from leftover clutter from past projects.
Docker Tutorial & Hands-On Practice
Instead of cluttering this note with long code snippets, I've prepared a ready-to-use template repository. It comes pre-configured with a docker-compose.yml for PHP 8.3, MySQL, and phpMyAdmin.
All setup steps, full commands, and source code are available directly on GitHub:
👉 Docker Beginner Template Tutorial
Feel free to clone and use this template as the foundation for your own local setup. If you need version adjustments, simply edit the docker-compose.yml file and match it to your needs.
