
Docker & Containerization
Dockerfile, docker-compose, multi-stage builds, container optimization, environment configuration
1What is the primary role of a Dockerfile in a .NET application?
What is the primary role of a Dockerfile in a .NET application?
Risposta
The Dockerfile defines instructions to create a reproducible Docker image containing the .NET application and its dependencies. It specifies the base image, build commands, files to copy, and the execution command. This ensures the application runs identically across all environments.
2Which base image is recommended for an ASP.NET Core application in production?
Which base image is recommended for an ASP.NET Core application in production?
Risposta
The mcr.microsoft.com/dotnet/aspnet image is optimized for running ASP.NET Core applications in production. It contains only the necessary .NET runtime, without SDK or build tools, which significantly reduces the final image size and improves security. For building, use mcr.microsoft.com/dotnet/sdk in a multi-stage build.
3What is a multi-stage build in a .NET Dockerfile?
What is a multi-stage build in a .NET Dockerfile?
Risposta
A multi-stage build uses multiple FROM instructions in a Dockerfile to create intermediate images. The first stage uses the SDK image to compile the application, while the final stage uses the lighter runtime image and copies only the compiled binaries. This reduces the final image size by several hundred MB by excluding build tools and source files.
Why copy the .csproj file before the rest of the source code in a Dockerfile?
Which command builds a Docker image from a Dockerfile?
+13 domande da colloquio
Altri argomenti di colloquio .NET
C# Basics
LINQ & Delegates
C# Language Essentials
ASP.NET Core Fundamentals
ASP.NET Core Request Lifecycle
Configuration & Settings
Application Lifecycle
Dependency Injection
Entity Framework Core
Minimal APIs
Web API Development
Async in ASP.NET Core
Authentication & Authorization
HttpClient & Networking
JSON Serialization
Entity Framework Core Advanced
C# Advanced Features
Clean Architecture
Logging, Monitoring & Observability
Unit Testing & xUnit
Integration Testing
NuGet Package Management
Memory Management & GC
Reactive Programming
Async/await & Patterns
.NET Design Patterns
Performance Optimization
Security & Best Practices
SignalR & Real-time
Microservices Architecture
Padroneggia .NET per il tuo prossimo colloquio
Accedi a tutte le domande, flashcards, test tecnici, esercizi di code review e simulatori di colloquio.
Inizia gratis