Create a tar archive using .Net Core (.Net 5)

  .net-5, docker, tar

Im trying to use the following lib to automatically build an image and run it as a container:
https://github.com/dotnet/Docker.DotNet

Basically its just a wrapper of the Docker Engine API:
https://docs.docker.com/engine/api/v1.41/#operation/ImageBuild

However, as stated by the Docker engine API documentation for the "build an image"-section, it expects the request body to be a tar-archive.. but I cant really find any good .Net libraries for generating a tar, and from my understanding I cant reallt do this by using any of the default APIs in .Net Core (.Net 5) or .Net standard.

I tried to use SharpZipLib and following this:
https://github.com/icsharpcode/SharpZipLib/wiki/GZip-and-Tar-Samples. But all the APIs referenced in that sample are marked as deprecated.

Could use some help in pointing me in the right direction of how to create a tar-archive using .Net

Source: Docker Questions

LEAVE A COMMENT