DEV Community

Barış Yıldızoğlu
Barış Yıldızoğlu

Posted on

How Do You Set Up Local Microservices Development with Docker Compose?

Hey folks,

I’m working on a small side project built around a microservices architecture — a few API services, some databases, nothing huge. The folder structure looks like this:

~/myProject/
├── docker-compose.yml
├── .git/
├── service-a/
├── service-b/
└── service-c/
Enter fullscreen mode Exit fullscreen mode

When I run everything with docker-compose up, my code is on my own local machine, but dependencies live inside the containers, so VS Code keeps throwing lint/type errors (since node_modules or pip packages aren’t on my local machine).

If I try using Dev Containers and attach directly to a service, it works better — except that the .git folder isn’t mounted inside the container, so Git integration (history, branches, etc.) breaks inside VS Code. So my questions are:

  1. How do you handle this local vs container dev setup cleanly?
  2. Any best practices for microservice development with Docker Compose + VS Code Dev Containers?
  • Should I just mount the whole project, including .git, into the containers?
  • Maybe set up multi-stage Dev Containers?
  • Or is it better to keep containers running but code outside and sync changes somehow?
  • Or something else?

Would love to see how others structure their setups

Thanks in advance!

Top comments (0)