← スキル一覧に戻る

docker
by DevXoje
⭐ 0🍴 0📅 2026年1月18日
SKILL.md
name: docker description: Help with Docker setup, commands, and troubleshooting for the GeroCare development environment.
Docker Development Environment
This skill helps you understand and work with the Docker setup for GeroCare development.
When to Use
- When creating or modifying Docker configuration files (Dockerfile, docker-compose.yml, .dockerignore)
- When troubleshooting Docker issues
- When explaining Docker commands to developers
- When setting up the development environment
- When working with volumes, ports, or container networking
Project Docker Setup
GeroCare uses Docker to containerize the development environment, eliminating the need for local Node.js, npm, or Firebase Tools installation.
Architecture
- Base Image:
node:20.19.0(matches package.json engines requirement) - Services: Two separate services for better isolation:
app: Vite dev serveremulators: Firebase emulators (Auth, Firestore, UI)
- Network: Internal Docker network (
gerocare-network) for service communication - Hot Reload: Enabled via volume mounts for source code in
appservice - Data Persistence: Firebase emulator data persisted in Docker volumes
- Healthcheck: Emulators service has healthcheck to ensure readiness before
appstarts
Port Mapping
| Port | Service | Description |
|---|---|---|
| 5173 | Vite Dev Server | Frontend development server |
| 8080 | Firestore Emulator | Firebase Firestore emulator |
| 9099 | Auth Emulator | Firebase Authentication emulator |
| 4000 | Firebase UI | Firebase Emulator Suite UI |
Volume Strategy
- Source Code Volume (
appservice only):.:/app- Mounts project root for hot-reload - Node Modules Volume (
appservice only):/app/node_modules- Anonymous volume to prevent host/container conflicts - Firestore Data Volume (
emulatorsservice only):firestore-data:/app/firestore_export- Persistent volume for emulator data
Network Strategy
- Internal Network:
gerocare-network(bridge driver) - Service Communication: Services use service names as hostnames
- App → Emulators:
appconnects to emulators usingemulatorsas hostname (viaVITE_EMULATORS_HOSTenv var)
Common Commands
Starting the Environment
# Build and start (first time or after Dockerfile changes)
docker-compose up --build
# Start existing containers
docker-compose up
# Start in detached mode (background)
docker-compose up -d
Stopping the Environment
# Stop containers (keeps volumes)
docker-compose down
# Stop and remove volumes (clears Firebase emulator data)
docker-compose down -v
Running Commands in Container
# Run npm commands in app service
docker-compose exec app npm run lint
docker-compose exec app npm run test:unit
docker-compose exec app npm run build
# Run commands in emulators service
docker-compose exec emulators firebase --version
# Run shell commands
docker-compose exec app sh # In app service
docker-compose exec emulators sh # In emulators service
Viewing Logs
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f app # App (Vite) logs
docker-compose logs -f emulators # Emulators logs
# Last 100 lines
docker-compose logs --tail=100
Rebuilding
# Rebuild without cache
docker-compose build --no-cache
# Rebuild and restart
docker-compose up --build
File Structure
Dockerfile
- Base:
node:20.19.0 - Installs Java 21 (for Firebase Emulators), curl (for healthchecks), and
firebase-toolsglobally - Copies package files and runs
npm ci - Exposes ports: 5173, 8080, 9099, 4000
- No default CMD (each service defines its own command)
docker-compose.yml
-
Service:
app- Runs
npm run dev(Vite dev server) - Mounts source code for hot-reload
- Exposes port 5173
- Depends on
emulatorswith healthcheck condition - Environment:
VITE_EMULATORS_HOST=emulatorsfor internal communication
- Runs
-
Service:
emulators- Runs
npm run emulators(Firebase emulators) - Persistent volume for Firestore data
- Exposes ports 4000 (UI), 8080 (Firestore), 9099 (Auth)
- Healthcheck to verify readiness
- Runs
-
Network:
gerocare-network- Bridge network for internal service communication
.dockerignore
- Excludes
node_modules,dist, logs - Excludes
.git,.env.local, temporary files - Optimizes build context size
Troubleshooting
Port Already in Use
If you get "port already in use" errors:
- Check what's using the port:
lsof -i :5173(macOS/Linux) ornetstat -ano | findstr :5173(Windows) - Stop local services using those ports
- Or change ports in
docker-compose.yml
Hot Reload Not Working
- Verify volume mount:
docker-compose exec app ls -la /app/src - Check file permissions
- Ensure Vite is watching the correct directory
Firebase Emulators Not Starting
- Check logs:
docker-compose logs emulators - Verify Firebase Tools installation:
docker-compose exec emulators firebase --version - Check
firebase.jsonconfiguration - Verify healthcheck status:
docker-compose ps - Ensure
firestore_exportdirectory exists or is created
App Not Connecting to Emulators
- Verify both services are running:
docker-compose ps - Check emulators health:
docker-compose logs emulators - Verify network connectivity:
docker-compose exec app ping emulators - Check
VITE_EMULATORS_HOSTenvironment variable inappservice
Node Modules Issues
If you encounter module resolution errors:
- Rebuild:
docker-compose down && docker-compose up --build - Clear node_modules volume:
docker-compose down -v(then rebuild) - Check volume mount:
docker-compose exec app ls -la /app/node_modules
Container Won't Start
- Check Docker is running
- Verify Dockerfile syntax
- Check logs:
docker-compose logs - Try rebuilding:
docker-compose build --no-cache
Best Practices
- Always use docker-compose for consistency across team
- Don't commit node_modules - they're in .dockerignore
- Use volumes for data persistence (Firebase emulator data)
- Check logs first when troubleshooting
- Rebuild after dependency changes in package.json
Integration with Development Workflow
The Docker setup runs services separately:
npm run dev- Vite dev server (inappservice)npm run emulators- Firebase emulators (inemulatorsservice)- All npm scripts work the same inside containers
- Hot-reload works identically to local development
- Services communicate via internal Docker network
Starting Services Separately
You can start services independently:
docker-compose up emulators- Only emulatorsdocker-compose up app- Only app (waits for emulators)docker-compose up- Both services
Accessing Services
Once running, access:
- App: http://localhost:5173
- Firebase UI: http://localhost:4000
- Firestore: http://localhost:8080
- Auth: http://localhost:9099
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です