I'm unable to switch docker to run in Linux mode on a 2019 Windows Server. I've found several guides online that show how to do this via powershell. After running the PS scripts I've noticed no virtual machine is installed in hyper-v, and after a server restart docker is still running in windows mode.
I enabled the Hyper-V windows role, and the Containers role. Docker seems to work fine in windows mode, I just can't get it to switch over to Linux.
Here is the PS I've executed trying to make the switch:
Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview
(Reboot machine)
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")
Restart-Service docker
When I run docker info
it continues to show OSType: windows. Also, when I view Hyper-V Manager I expected to see a VM for running Linux however there are no VMs. I think that might be related to the problem.
So I was able to resolve this issue. I'm currently running a Linux container in Docker on a Windows 2019 server, yet the OSType still says Windows... I guess I shouldn't expect that value to ever change to Linux (on my local Windows 10 machine it says OSType: Linux)?
Anyway, here are the steps I went through to get Linux containers running on my Windows 2019 server:
Powershell Scripts:
Install-Module "DockerMsftProvider" -Force
Update-Module "DockerMsftProvider"
Install-Package Docker -ProviderName "DockerMsftProvider" -Update -Force
NOTE: If prompted to install a Nuget provider type Y
Set-Content -Value "`{`"experimental`":true`}" -Path C:\ProgramData\docker\config\daemon.json
restart-service docker
This is where I found the solution: https://www.b2-4ac.com/lcow-linux-containers-on-windows-server/