Generate production-ready Docker configurations for .NET APIs with multi-stage builds, Alpine optimization, layer caching, and build scripts. Use when containerizing .NET applications, creating Dockerfiles, or optimizing existing Docker setups.
# Create skills directory in your project
mkdir -p .claude/skills/docker-dotnet-containerize
# Save the skill file
# Copy docker-dotnet-containerize.md to .claude/skills/docker-dotnet-containerize/SKILL.md
# Commit to version control
git add .claude/skills/
git commit -m "Add Docker containerization skill"
git push
# Create personal skills directory
mkdir -p ~/.claude/skills/docker-dotnet-containerize
# Save the skill file
# Copy docker-dotnet-containerize.md to ~/.claude/skills/docker-dotnet-containerize/SKILL.md
Once installed, the skill activates automatically when you mention Docker or containerization in your .NET project context.
Option 1: Natural Language (Recommended)
You: "I need to containerize my .NET API project"
Option 2: Direct Request
You: "Create Docker setup for this project"
Option 3: Specific Requirements
You: "Generate a Dockerfile for my .NET 8 Clean Architecture solution"
The skill will automatically:
You say:
Containerize my ASP.NET Core Web API
Claude will:
Expected output files:
your-project/
├── Dockerfile # Multi-stage build
├── .dockerignore # Optimized ignore patterns
└── (build commands provided in chat)
You say:
I have a Clean Architecture solution with Domain, Application, Infrastructure, and WebApi projects. Set up Docker for it.
Claude will:
You say:
Create Docker configuration for my DDD solution:
- 2 Domain projects
- 3 Infrastructure projects
- 4 Application services
- 1 API gateway
Claude will:
You say:
Generate a production-ready Dockerfile for .NET 8 API with:
- Smallest possible image size
- Security best practices
- Health check support
Claude will:
After the skill runs, verify the generated files:
# Validate Dockerfile syntax
docker build --check .
# Build to test
docker build -t test-build .
# View what will be sent to Docker context
docker build --no-cache --progress=plain . 2>&1 | grep "COPY"
Use the checklist Claude provides:
# Build the image
docker build -t myapi:dev .
# Run the container
docker run -d -p 8080:8080 --name myapi-test myapi:dev
# Check if it's running
curl http://localhost:8080/health
# View logs
docker logs -f myapi-test
# Stop and clean up
docker stop myapi-test && docker rm myapi-test
# Build with release configuration
docker build -t myapi:1.0.0 --build-arg BUILD_CONFIGURATION=Release .
# Tag for registry
docker tag myapi:1.0.0 myregistry/myapi:1.0.0
# Push to registry
docker push myregistry/myapi:1.0.0
You: "Add Docker support to this existing .NET 6 API"
The skill analyzes your current setup and generates appropriate configuration.
You: "Update my Dockerfile to use .NET 8 and Alpine Linux"
The skill generates a new optimized version.
You: "I need Docker setup for my API and background worker service"
The skill can handle multiple entry points.
You: "My Dockerfile build is failing with 'project not found' error"
The skill provides troubleshooting guidance and fixes.
Good:
"Containerize my .NET 8 Clean Architecture solution with separate Domain, Infrastructure, Application, and WebApi projects"
Less Effective:
"Add Docker"
"Create Dockerfile optimized for small image size and fast rebuilds"
"I'm using ABP Framework, please generate appropriate Docker setup"
"Need Docker setup with health checks and support for environment variables"
# After skill generates files
git add Dockerfile .dockerignore
git commit -m "Add Docker containerization"
The generated Dockerfile works with standard CI/CD pipelines:
# Example GitHub Actions
- name: Build Docker image
run: docker build -t ${{ env.IMAGE_NAME }}:${{ github.sha }} .
If you need docker-compose later:
You: "Can you also create a docker-compose.yml for local development?"
Problem: You asked about Docker but the skill didn't activate.
Solutions:
Verify skill installation:
# Check if skill file exists
ls .claude/skills/docker-dotnet-containerize/SKILL.md
# or
ls ~/.claude/skills/docker-dotnet-containerize/SKILL.md
Check YAML frontmatter syntax:
head -n 5 .claude/skills/docker-dotnet-containerize/SKILL.md
Use explicit keywords:
"Containerize" or "Docker setup" or "Create Dockerfile"
Problem: Build fails with errors.
Solutions:
Share the error with Claude:
You: "The Docker build failed with this error: [paste error]"
Claude will analyze and provide fixes.
Problem: Generated files need modifications.
Solution: Ask for specific changes:
You: "Update the Dockerfile to include curl for health checks"
You: "Add build arguments for version and build number to the Dockerfile"
You: "Optimize the Dockerfile for faster local development rebuilds"
You: "Enhance the Docker configuration with additional security measures"
You: "Can we reduce the final image size further? Currently at 150MB"
When new best practices emerge:
# Edit the skill
nano .claude/skills/docker-dotnet-containerize/SKILL.md
# Test with Claude
# Restart Claude Code session to reload
# Project skill is automatically shared via git
git pull # Team members get the skill
You: "Explain the generated Dockerfile line by line"
You: "Why did you structure the COPY commands this way?"
You: "How can I optimize this further?"
Q: Can I modify the generated Dockerfile?
A: Yes! The generated files are templates. Customize as needed.
Q: Will this work with my CI/CD pipeline?
A: Yes, the Dockerfiles use standard Docker syntax compatible with all platforms.
Q: How do I handle secrets in the build?
A: Use Docker secrets or build arguments. Ask Claude: "How do I handle database connection strings in the Docker build?"
Q: Can this handle multiple services?
A: Yes. Ask: "Create Dockerfiles for both my API and Worker services"
1. You: "Set up Docker for this new .NET 8 API project"
2. Claude: [Generates Dockerfile and .dockerignore]
3. You: "Test it"
docker build -t myapi:test .
4. You: "Works great! Can you add a health check?"
5. Claude: [Updates Dockerfile with HEALTHCHECK]
1. You: "Update my Dockerfile from .NET 6 to .NET 8"
2. Claude: [Generates updated configuration]
3. You: "Also optimize for smaller image size"
4. Claude: [Adds size optimizations]
1. You: "My Docker build is failing: [error]"
2. Claude: [Analyzes error and provides fix]
3. You: "Still not working, here's the full output: [logs]"
4. Claude: [Provides detailed solution]
latest in productionThis skill makes Docker containerization for .NET projects effortless:
下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer