.NET

Docker & Containerization

Dockerfile, docker-compose, multi-stage builds, container optimization, environment configuration

16 면접 질문·
Mid-Level
1

What is the primary role of a Dockerfile in a .NET application?

답변

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.

2

Which base image is recommended for an ASP.NET Core application in production?

답변

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.

3

What is a multi-stage build in a .NET Dockerfile?

답변

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.

4

Why copy the .csproj file before the rest of the source code in a Dockerfile?

5

Which command builds a Docker image from a Dockerfile?

+13 면접 질문

다음 면접을 위해 .NET을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기