docker-watch-mode-2025
Docker Compose Watch mode for automatic hot reload during local development with sync, rebuild, and restart actions
When & Why to Use This Skill
This Claude skill streamlines local development workflows by leveraging Docker Compose Watch mode. It automates the synchronization of file changes, triggers container rebuilds for compiled languages, and manages service restarts for configuration updates, providing a high-performance alternative to traditional bind mounts with zero manual intervention.
Use Cases
- Frontend Development: Enable instant hot reload for React, Next.js, or Vue.js applications by syncing source code changes directly into the running container.
- Backend Compilation: Automatically trigger image rebuilds and container recreation for compiled languages like Go, Rust, or Java whenever a file change is detected.
- Configuration Hot-Swapping: Sync environment variables or configuration files and automatically restart services to apply changes without stopping the entire stack.
- Cross-Platform Development: Ensure consistent file synchronization and performance across different operating systems by avoiding common bind mount permission and speed issues.
| name | docker-watch-mode-2025 |
|---|---|
| description | Docker Compose Watch mode for automatic hot reload during local development with sync, rebuild, and restart actions |
Docker Compose Watch Mode (2025 GA)
Docker Compose Watch enables automatic hot reload during local development by synchronizing file changes instantly without manual container restarts.
Three Watch Actions
1. sync - Hot Reload
For frameworks with hot reload (React, Next.js, Node.js, Flask). Copies changed files directly into running container.
2. rebuild - Compilation
For compiled languages (Go, Rust, Java) or dependency changes. Rebuilds image and recreates container when files change.
3. sync+restart - Config Changes
For configuration files requiring restart. Syncs files and restarts container.
Usage
services:
frontend:
build: ./frontend
develop:
watch:
- action: sync
path: ./frontend/src
target: /app/src
ignore: [node_modules/, .git/]
- action: rebuild
path: ./frontend/package.json
Start with: docker compose up --watch
Benefits
- Better performance than bind mounts
- No file permission issues
- Intelligent syncing
- Supports rebuild capability
- Works on all platforms