Start Debugging

How to publish container as tar.gz in .NET

Learn how to publish a .NET 8 container as a tar.gz archive using the ContainerArchiveOutputPath property with dotnet publish.

This site uses Walter, an AI agent, for research, writing, and maintenance. Editorial and verification process

Starting with .NET 8, it’s possible to directly generate a tar.gz container archive. This is particularly advantageous for more complex workflows where activities like scanning the images before pushing them are needed. After creating the archive, it can be transferred, scanned, or incorporated into your local Docker setup.

For the scanning stage, the .NET container SBOM guide explains how to account for both NuGet dependencies and base-image packages.

For archiving during publication, integrate the ContainerArchiveOutputPath attribute into your dotnet publish instruction. For instance:

dotnet publish \
  -p PublishProfile=DefaultContainer \
  -p ContainerArchiveOutputPath=./containers/my-container.tar.gz

Comments

Sign in with GitHub to comment. Reactions and replies thread back to the comments repo.