Documentation Index
Fetch the complete documentation index at: https://docs.podarmor.org/llms.txt
Use this file to discover all available pages before exploring further.
This guide demonstrates how to use a PodArmor .NET image to build a simple .NET application.
Pull a PodArmor .NET Image
Pull the PodArmor .NET image using the following command, with the version you want to use:
docker pull parmor.azurecr.io/dotnet/dotnet:8.0
docker pull parmor.azurecr.io/dotnet-runtime/dotnet-runtime:8.0
Create a .NET container
Create a .NET application container
Create a new directory mkdir dotnet-quickstart && cd dotnet-quickstart and create a Program.cs file with the following content:Console.WriteLine("Hello, PodArmor!");
Create a Dockerfile
Create a Dockerfile with the following content:FROM parmor.azurecr.io/dotnet/dotnet:8.0
WORKDIR /app
COPY Program.cs .
RUN dotnet new console -o . --force
ENTRYPOINT ["dotnet", "run"]
Build the Docker image
Build the Docker image using the following command:docker build -t dotnet-quickstart .
Run the Docker container
Run the Docker container using the following command:docker run dotnet-quickstart
Create a .NET runtime container
Initialize Project
Create a new directory mkdir dotnet-project && cd dotnet-project.Create a Program.cs file with a JSON serialization example:using System;
using System.Text.Json;
public class Program {
public static void Main() {
var data = new { Message = "PodArmor Secure", Value = System.Random.Shared.Next(1, 100) };
Console.WriteLine(JsonSerializer.Serialize(data));
}
}
Create Project File
Create a dotnet-project.csproj file with the following content:<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
Create a Dockerfile
Create a Dockerfile with the following content:FROM parmor.azurecr.io/dotnet/dotnet:8.0 AS build
WORKDIR /app
COPY . .
RUN dotnet restore
RUN dotnet publish -c Release -o /out
FROM parmor.azurecr.io/dotnet-runtime/dotnet-runtime:8.0 as runtime
WORKDIR /app
COPY --from=build /out .
ENTRYPOINT ["dotnet", "dotnet-project.dll"]
Build the Docker image
Build the Docker image using the following command:docker build -t dotnet-project .
Run the Docker container
Run the Docker container using the following command:docker run dotnet-project