Closed assad-faizi closed 9 months ago
I don't think Sitecore maintains this repo anymore. But this issue you are seeing is related to an issue with Docker on Windows and file locks --
Thanks @nickwesselman . I suspected this wasn't actively maintained given there are open issues dating back 4 years ago. I've decided to go down another route.
What I've discovered is that it seems like the dotnet watch works fine with .NET 6 in a windows container when I create a "Hello World" containerised (Windows) console app.
I then further discovered there is a Visual Studio Template called Sitecore Simple Container-based ASP.NET Core Solution (Sitecore) developed by Sitecore which is already .NET 6 and uses dotnet watch
It works (ish) - the rendering container spins up successfully. I'm having issues with the sitecore instances not returning as healthy containers:
Going to explorer this a bit and will update here.
For those interested in using the Sitecore Simple Container-based ASP.NET Core Solution (Sitecore) Visual Studio Template and experience the same error above, I discovered the root cause. It's to do with the SQL_SA_PASSWORD
that is generated in the .env file. When you run .\init -InitEv
which initialises the .env file, the SQL password generated doesn't appear to be complex enough (see https://navansitecorenotes.blogspot.com/2020/12/is-docker-compose-up-sensitive-to.html). If you manually set the SQL_SA_PASSWORD
to something like PAssw0rd123$
, it will work. Or you could modify the init.ps1
from this:
Set-EnvFileVariable "SQL_SA_PASSWORD" -Value (Get-SitecoreRandomString 19 -DisallowSpecial -EnforceComplexity)
to this:
$SqlSaPassword = (Get-SitecoreRandomString 19 -DisallowSpecial -EnforceComplexity) + "$"
Set-EnvFileVariable "SQL_SA_PASSWORD" -Value $SqlSaPassword
Bit of a hack but it works. It seems there needs to be at least one special character. Removing the -DisallowSpecial switch param isn't reliable as it could use a character that isn't supported.
BTW, when using the Sitecore Simple Container-based ASP.NET Core Solution (Sitecore) Visual Studio Template, the dotnet watch
works successfully.
It seems like the dotnet watch command specified in the rendering Dockerfile fails to make the changes to the application due to another process locking the dll that is trying to be updated.
Steps to reproduce
<h1>Hello World<h2>
below header placeholder (Performed this in VS Code)Expected Behaviour
Actual Behaviour
I came across this thread which suggests the issue is with the nanoserver base images which is lacking the
taskkill
tool required bydotnet watch
. The only workaround is to create custom SDK image based on servercore.given that the
dotnet watch
tool is used in the Sitecore examples project I'm wondering how did this work?