I am aware there are a lot of questions about running Docker on windows, however this question is about running the brand new Docker for Windows, on Windows.
In my case I am
If you are here because you have this issue in Visual Studio 2019:
According to this post, the VS team is preparing a fix for this issue in 16.5 version, meanwhile, you can add the property "publishAllPorts": true
in your launchSettings.json, for example:
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:44374", #<== Set a fixed port
"environmentVariables": {
"ASPNETCORE_URLS": "https://+:44374;https://+:5000",
"ASPNETCORE_HTTPS_PORT": "44374"
},
"publishAllPorts": true, #<== This is equivalent to the -P flag in 'docker run'
"useSSL": true
}
Notice that the property "httpPort": XYZT
is not defined. Having it defined will make the workaround not work.
It worked for me with this setup:
I realized that the command VS was creating, contained the -p parameter twice, one with the port I specified and another with port 80, like this: -p 3010:80 -p 3010:3010
.
After adding publishAllPorts
it now creates the container and I can remotely debug it.