AgentSkillsCN

docker

为 VanDaemon 配置 Docker 与 Docker Compose 容器化方案。 适用于:构建容器、配置 docker-compose、部署至 Docker 环境、排查容器网络问题,或搭建多容器应用时使用。

SKILL.md
--- frontmatter
name: docker
description: |
  Configures containerization with Docker and Docker Compose for VanDaemon.
  Use when: building containers, configuring docker-compose, deploying to Docker environments, troubleshooting container networking, or setting up multi-container applications.
allowed-tools: Read, Edit, Write, Glob, Grep, Bash

Docker Skill

VanDaemon uses a multi-container architecture with separate API and Web containers for local development, plus a combined single-container deployment for Fly.io. The API runs on .NET 10, the Web frontend uses nginx to serve Blazor WASM static files and proxy API/WebSocket requests. Data persists via Docker volumes for JSON file storage.

Quick Start

Start Development Environment

bash
# From solution root
docker compose up -d

# View logs
docker compose logs -f

# Rebuild after code changes
docker compose up --build

Access Points

ServiceURLPurpose
Web UIhttp://localhost:8080Blazor WASM frontend
APIhttp://localhost:5000REST API + Swagger
Healthhttp://localhost:5000/healthContainer health check
SignalRws://localhost:5000/hubs/telemetryReal-time updates

Key Concepts

ConceptUsageExample
Multi-stage buildsMinimize image sizeFROM sdk AS buildFROM aspnet AS final
Health checksContainer orchestrationHEALTHCHECK CMD curl /health
Volume mountsPersist JSON dataapi-data:/app/data
Bridge networkInter-container commshttp://api:80 not localhost:5000
SupervisorMulti-process containerCombined nginx + API for Fly.io

Common Patterns

Container Networking

When: Containers need to communicate

yaml
# docker-compose.yml
services:
  web:
    depends_on:
      api:
        condition: service_healthy
    # Use container name, not localhost
    environment:
      - API_BASE_URL=http://api:80

Volume Persistence

When: Data must survive container restarts

yaml
volumes:
  api-data:
  api-logs:

services:
  api:
    volumes:
      - api-data:/app/data    # JSON config files
      - api-logs:/app/logs    # Serilog output

See Also

Related Skills

  • See the dotnet skill for .NET 10 SDK configuration in Dockerfiles
  • See the aspnet-core skill for API container configuration
  • See the serilog skill for log volume configuration