Docker ist ein ideales Artefaktformat für die Bereitstellung von Anwendungen. Die standardisierten Schnittstellen reduzieren die Komplexität auf der Seite des Betriebs, aber auf der Entwicklungsseite kommen nun neue Aufgaben hinzu. Was dies im Detail bedeutet, wird in dieser Präsentation erläutert, ebenso wie die technischen Grundlagen und Best Practices für die Docker-basierte Entwicklung.
18. ▪ Versioned artifact
▪ Isolated deployable unit
▪ Container image is bit by bit identical when
deployed
▪ Abstraction of data center resources
▪
▪ Orchestration is “Cattle Business”
▪
▪
19. Server
Host OS
Hypervisor
Server
Host OS
Docker Engine
Guest
OS
Guest
OS
Guest
OS
Bins/Libs Bins/Libs
App A App A’ App B
Bins/Libs Bins/Libs
AppA
AppA’
AppB
AppB’
AppB
AppB’
AppB
AppB’
Containers are isolated, but
share OS and, where
appropriate, bins/librariesBins/Libs
Image Source: https://sec.ch9.ms/sessions/build/2016/B822.pptx
20. My ASP.NET Core Application
microsoft/dotnet:2.1.4-
aspnetcore-runtime
microsoft/dotnet:2.1-runtime-
deps-alpine3.7
alpine:3.7
33. FROM microsoft/dotnet:2.1-aspnetcore-
runtime
WORKDIR /app
COPY output/app .
ENTRYPOINT ["dotnet", "HelloWorld.dll"]
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["HelloWorld/HelloWorld.csproj", "HelloWorld/"]
RUN dotnet restore "HelloWorld/HelloWorld.csproj"
COPY . .
WORKDIR "/src/HelloWorld"
RUN dotnet build "HelloWorld.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "HelloWorld.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "HelloWorld.dll"]
34. docker build –t <reponame>:<tag> .
docker image ls
REPOSITORY TAG IMAGE ID
HelloWorld latest 326387cea398
35.
36.
37. Developer PC / Laptop
Docker Engine
Container Container Container