Lesson 10 of 40
DevOps
Intermediate
50 min
Docker & Container Development
Build, debug, and deploy containerized applications using VS 2026's Docker tooling, container orchestration support, and Aspire integration.
Part 1: Adding Docker Support
Right-click project → Add → Docker Support. VS 2026 generates an optimized multi-stage Dockerfile:
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:10.0
COPY --from=build /app .
ENTRYPOINT ["dotnet", "MyApp.dll"]
WORKDIR /src
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:10.0
COPY --from=build /app .
ENTRYPOINT ["dotnet", "MyApp.dll"]
Part 2: Docker Compose Orchestration
Add Container Orchestration Support → Docker Compose to manage multi-container apps. VS 2026 generates a
docker-compose.yml and launches all services in the correct order with F5.Part 3: .NET Aspire Integration
.NET Aspire is the modern cloud-native stack for .NET 10. VS 2026 has first-class Aspire support:
- Create Aspire starter projects from New Project dialog
- Aspire Dashboard integrates in the Diagnostics Hub
- Service discovery, resilience, and telemetry configured automatically
Part 4: Debugging in Containers
Set breakpoints normally — VS 2026 attaches the debugger into the running container automatically. The debugging experience is identical to local debugging: Watch windows, Immediate window, edit-and-continue all work inside containers.