Can't setup up Windows Server Containers on Windows Server 2016 TP4 - windows

I'm trying to setup up Windows Server Containers on Windows Server 2016 TP4.
I'm following the guideline from MS, but it does not work. It always fails with the following error:
Getting Container OS image (WindowsServerCore) version 10.0.10586.0 from OneGet (this may take a few minutes)...
C:\Install-ContainerHost.ps1 : Unable to download.
In Zeile:1 Zeichen:1
+ C:\Install-ContainerHost.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ContainerHost.ps1
I could find out that the Install-ContainerHost.ps1 script tries to download the WindowsServerCore image from here. Calling this URL manually returns "BlobNotFound".
I am not sure if this is some fault from me or they just have a problem with the server. I have tried to run the script already several times today. Yesterday it worked on another VM..
Edit: Seemed to be a problem from Micrsoft with the download server, which was fixed now.

OK this is what we did go to your ISO for TP4, and open the ISO.
Inside there's a folder for "NanoServer" in which you can find the wim File (image).
Copy this image locally, or where you prefer on the internet. Get the URL, you're going to use it to hack the Powershell script.
Run these commands in Powershell
Install-Package ContainerProvider
Verify the Package has been installed by running:
Find-ContainerImage
Notepad Open: C:\Program Files\WindowsPowerShell\Modules\ContainerProvider\0.5.2\ContainerProvider\ContainerProvider.psm1
Go to line: 508 and modify the Variable $downloadURL: (notice how I used my own url)
$downloadURL = "http://10.0.2.2:8000/NanoServer.wim"
After this: Just run
Install-ContainerImage -Name NanoServer
The image will be installed

Related

nginx commands not working after installing and running

I have installed nginx on Windows 10. After the install if I navigate to http://locahost in a browser I see the homepage for nginx. However when working with a nginx.conf file I am trying to run nginx -t but I get the following error:
nginx : The term 'nginx' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ nginx -t
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (nginx:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I've tried seeing if there is a Windows Path change I need to do, but have not come across anything else that says that needs to be done. I have tried running this command as an Administrator or non root user but still am getting the same message. Any advice would be appreciated.

docker.exe - This application could not be started

Installing Docker Desktop version 3.1.0 on Windows 10 with WSL 2.
On first time running command docker --version it returns
docker.exe - This application could not be started
and a pop-up
which leads me to
https://learn.microsoft.com/en-us/dotnet/framework/install/application-not-started?version=(null)&processName=docker.exe&platform=0009&osver=7&isServer=0&shimver=4.0.30319.0
I checked my .Net Version its fine and up to date.
And Next time I try to run docker command it returns
Program 'docker.exe' failed to run: Access is deniedAt line:1 char:1
+ docker ps
+ ~~~~~~~~~.
At line:1 char:1
+ docker ps
+ ~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
So this might be the issue of Permission, I couldn't agree more.
So I added my current Authenticated User in docker-users In-fact I added almost all the possible users in docker-users.
Still no luck
Then I gave Read Write permissions also, to all possible users.
But still no luck.
One very clear Solution, Re Install the Windows which I want to use as Last resource.
Jump in the dark will be appreciable
Thanks in advance 🙏

Windows 10 IOT UWF Unified Write Filter implementation powershell applyupdate is not recognized as the name of cmdlet

I was trying to implement windows 10 iot Unified Write Filter implementation.
I wanted to run these commands to remote iot device through powershell.
change to the directory where you have copied your files
cd C:\UWFTemp
commands to install the packages to your IoT device system image:
applyupdate –stage .\Microsoft-IoTUAP-UnifiedWriteFilter-Package.cab
applyupdate –stage .\Microsoft-IoTUAP-UnifiedWriteFilter-Package_Lang_en-us.cab
applyupdate –commit
And I'm getting error as
PS C:\UWFTemp> applyupdate -stage Microsoft-IoTUAP-UnifiedWriteFilter-Package.cab
The term 'applyupdate' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (applyupdate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The file which I'm running this command exists and working fine. I'm new to shell scripting, I couldn't find how to install package for get running the applyupdate command.
It seems that you have not accessed the remote device via Powershell. Please try to copy the packages into your device and connect the remote device via Powershell. This document shows how to use UWF on Windows 10 IoT Core(https://learn.microsoft.com/en-us/windows/iot-core/secure-your-device/unifiedwritefilter).

Docker for Windows - Install certificates using sn.exe / Strong Name utility

We have a Docker image that we use to build our Visual Studio solutions. This works great. Now we have some solutions that require a key. To install the key you use sn.exe, but Microsoft has gone through great lengths to make sure human input is needed, namely the password..
The image is based off FROM microsoft/dotnet-framework:3.5
I tried several tricks, especially from this Stack Overflow thread: Auto-entering Password In Sn.exe
The last answer is mine (Thomas Rijsewijk). At least I have a working way to install the key automatically, but somehow SendWait doesn't work in Docker, or Docker for Windows, or microsoft/dotnet-framework:3.5 docker image.
# ---------
# Import all certificates in C:\keys
# ---------
[void][System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("hello")
When I run this I get "Access Denied":
Exception calling "SendWait" with "1" argument(s): "Access is denied"
At K:\install-certificates.ps1:51 char:1
+ [System.Windows.Forms.SendKeys]::SendWait("hello")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
As an alternative I tried SendKeys() from WScript.Shell:
$wshell = New-Object -com wscript.shell;
Sleep 5;
$wshell.sendkeys("test");
Again, this works perfectly on my machine (Windows 10 up to date) and an up to date Windows 2016 server. But NOT inside the docker image: nothing happens, no error but it's not entering "test" either.
Lot of talks about automating powershell, but basically I don't really care HOW I install the certificate when building my docker image, I just want it installed. I install the certificate locally using
Start-Process "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" -ArgumentList "-i `"D:\key.pfx`" VS_KEY_XXXXXXXX" -NoNewWindow;
At this point, it asks for a password which makes it impossible to use with docker build.
I did a whole lot of searching on Google and SO, I'm surprised to see that nobody else tried to install a key using sn.exe.
PS: Yes, I know VS_KEY_XXXXXXXX is not a valid VS_KEY. I already have a working mechanism for extracting the right VS_KEY, but that's out of scope of this question.
PPS: Yes, I know I could manually running the docker, install the certificate and manually commit and push the changes. But naturally, I want it to originate from my Dockerfile

Service fabric deployment works from Visual studio, but PS script from output doesn't work in a Powershell window

Same deploy package, same cluster, no security. If I deploy through VS2015 everything goes swimmingly. If I watch the output in VS, I can see what PS script it is executing and with what parameters. If I copy that script to a powershell window (running as admin) and execute it there, I get the below error
WARNING: Unable to Verify connection to Service Fabric cluster.
Test-ServiceFabricClusterConnection : Cluster connection instance is null
At C:\Program Files\Microsoft SDKs\Service
Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:143 char:16
+ [void](Test-ServiceFabricClusterConnection)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Test-ServiceFabricClusterConnection], NullReferenceException
+ FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.TestClusterConnection
Why would the same script with the same parameters work in VS and not in Powershell?

Resources