Using a .NET7 project how to pass in ContainerEnvironmentVariable parameter via command line for the donet publish command?

122 views Asked by At

With .NET7 we can use the dotnet publish command to build a docker container. How do you pass in environment variables via the command line?

You can use the following to build the container and specify a container image name but how to specify the ContainerEnvironmentVariable: dotnet publish --os linux --arch x64 -p:ContainerImageName=MyContainer -c Release

-p:ContainerEnvironmentVariable=? -> How to build this parameter?

since ContainerEnvironmentVariable is a more complex parameter.

https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container

0

There are 0 answers