docker.exe - This application could not be started - windows

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 🙏

Related

'.vendor/bin/sail' Is not working in windows

everyone!
I just trying to pull a php/laravel repo to my windows computer and make it runs with docker.
I already download docker, wsl, ubuntu and everything else it suppose you need to make it works.
But when I launch the command ".vendor/bin/sail" into the root folder the following message it showed up.
.vendor/bin/sail : The term '.vendor/bin/sail' 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
+ .vendor/bin/sail up
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (.vendor/bin/sail:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have tried to add a .zsrch file to setup an alias. But is not working neither.

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.

Windows service on docker does not start

I've created a C# WCF Windows service app in VS 2017 and added Docker Support.
The following Dockerfile was created:
FROM microsoft/dotnet-framework:4.7.1-windowsservercore-1709
ARG source
WORKDIR /app
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["C:\\WcfService.exe"]
When I build it using docker-compose in VS I get an error:
Cannot start service from the command line or a debugger. A Windows
Service must first be installed (using installutil.exe) and then
started with the ServerExplorer, Windows Services Administrative tool
or the NET START command. The program '[2172] WcfService.exe' has
exited with code 0 (0x0).
I've opened PowerShell and typed docker ps - the container is running.
So I used New-Service command and to create "TestService".
When I use Get-Service to see all services, I can see it in the list in 'Stopped' mode.
When I use Start-Service TestService I get the following error:
Start-Service : Failed to start service 'TestService (TestService)'.
At line:1 char:1
+ Start-Service TestService
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController)
[Start-Service], ServiceCommandException
+ FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand
Tried to find info but nothing works. Any ideas?
Ok, so I took Jeroen's advice and dug deeper to see the event viewer. I used some filters on the 'Get-EventLog' command to get the relevant error line and stored it in a variable
$A = Get-EventLog -LogName System -Newest 10 -Source "Service Control Manager" | Select *
Then, I formatted it nice using something like:
$A | Format-List -Property *
and got the exception.
Apparently it has something to do with a C++ dll my app is using. It could be missing or the environment has trouble running it, but that's another issue which I believe I can solve.
Hope that helps others running into similar issues. Thanks.

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

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

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

Resources