When I try to run Debug F5 from VS 2019 using Docker I see the following error
C:\Users\comet.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.9.10\build\Container.targets(198,5): error CTC1001: Volume sharing is not enabled. On the Settings screen in Docker Desktop, click Shared Drives, and select the drive(s) containing your project files.
I have WSL2 and latest Docker Desktop, google says that sharing is already done automatically so Desktop has no such Setting at all
I had the same problem with an older project. Creating a new project with docker support worked fine. The difference I found that the old project file had:
<OutputType>Exe</OutputType>
and the new project did not have that line, so I removed it. Also updated the targets:
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
This solved it for me