Junior — Middle
Mis on Dockeriga konteineriseerimise peamine eesmärk?
sobes.tech AI
Vastus AI-lt
The main goal of containerization using Docker is to ensure the isolation and portability of applications along with all their dependencies in lightweight, standardized containers.
This allows:
- running applications in a uniform environment on different machines and platforms,
- quickly deploying and scaling services,
- simplifying dependency and configuration management,
- improving resource utilization efficiency compared to virtual machines.
Example Dockerfile for a simple C# application:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build /app/out ./
ENTRYPOINT ["dotnet", "MyApp.dll"]
This container can be run on any machine with Docker without additional environment setup.