Docker failed to initialize Docker-Desktop 4.16.1 - windows

OS Windows 11 21H2 OS Build 2000.1455
Docker 4.16.1
I have created a MSI file which executes a PowerShell script by using a bat file. PowerShell script enables wsl and Virtual Machine features. Download and installs Linux kernel update package and docker-desktop. After system reboot, we invoke docker desktop by using
& C:\Program Files\Docker\Docker\Docker Desktop.exe
Docker desktop starts and PowerShell script executes docker compose up -d command to configure a web application. it works fine on my
system with OS Windows 11 21H2 OS Build 2000.1455.
But on client’s system with OS Windows 11 21H2 OS Build 2000.1455, See image attached.
Docker desktop starts and then it shows “Docker Failed to Initialize” message with description
“Could not load file or assembly ‘Nlog version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c’ or one of its dependencies. The system can not find the file specified.”
I searched and i am unable to find this error in context of docker(it is available for c#). Can somebody help me to replicate this issue or provide me a solution for the same?
Please let me know if you have any questions?
Thanks!
I searched for the solution at github
https://github.com/docker/for-win/issues
I also searched and added question at
https://forums.docker.com/t/docker-failed-to-initialize-docker-desktop-4-16-1/134167
I am not able to replicate this on my machine and one another machine with fresh windows install. This issue is occurring at client's machine with same configuration.

Related

How to run Windows Nano Server container from Windows 10 Pro?

My host is running Windows 10 Pro, version 2004, build 19041.1052. I have the Hyper-V and Containers Windows Features enabled. I am running Docker Desktop 4.0.0 (67817), Engine 20.10.8. I have chosen the engine for Windows Containers. I have pulled the Nano Server image tagged 2004-amd64 (build 19041.1165). I have a Ryzen 9 CPU. When I try to run the image with this command from a PowerShell run as Administrator:
docker run -it mcr.microsoft.com/windows/nanoserver:2004-amd64 --rm cmd.exe
I get this error:
C:\PROGRAM FILES\DOCKER\docker.exe: Error response from daemon: container
52d69ec5645099a0c729a285c1192f4cb909f167d36efa4cf60cf9cc82c6cd56 encountered an error
during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot
find the file specified. (0x2).
Searching this error yields a few questions from people having trouble building an image. None that I have seen have an accepted answer, and none of the suggestions seem relevant to me (most are focused on editing the Dockerfile).
I'm not married to this image tag. I would like to run some version of Nano Server or Server Core. Is it possible? How can I do it?
Today, after pulling and running mcr.microsoft.com/dotnet/framework/sdk:latest and mcr.microsoft.com/windows/servercore:2004-amd64 (both of which worked), I am now able to run the image mcr.microsoft.com/windows/nanoserver:2004-amd64 that was giving me trouble yesterday. I don't know what fixed it. Maybe some image layer was missing that got filled in by pulling another image using the same layer?

Where can I see log files for failed Docker Desktop Windows installation?

I am trying to install Docker Desktop for Windows on Windows 10.
The installer triggers the UAC prompt but then nothing else, silently dies.
Q: Where can I find the log files from Docker Desktop Installation (attempt)?
(Is there a command line argument I need to pass to Docker Desktop Installer.exe?)
Details:
Windows 10 Pro 64bit: 20H2, virtualization and hyper-v enabled
Docker Desktop: 3.3.3.64133
Context: I used to successfully run Docker Desktop, but an update failed and I could not install or uninstall it. I needed to see the installation log files.
Install logs are automatically generated by Docker Desktop Installer.exe, and can be found in:
%LocalAppData%\Docker\

Can I run Windows containers on Docker Desktop for Mac? [duplicate]

This question already has answers here:
How can I run a docker windows container on osx?
(3 answers)
Closed 1 year ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
I want to be able to run Windows Docker Containers on my Mac, it seems this was sort of supported using Docker Toolbox
How can I run a docker windows container on osx?
But it seems that this is now deprecated and we should be using Docker Desktop now.
Docker Desktop has a better and New Hypervisor called HyperKit instead of Virtual Box https://docs.docker.com/docker-for-mac/docker-toolbox/
Docker toolbox allowed starting Windows Containers using VirtualBox, so not sure if that mean's that this is still possible?
I have found a reference to putting Docker Desktop into "Windows Container Mode" here https://www.clearpeople.com/insights/blog/2018/june/sitecore-demo-in-a-docker-container
But I cannot find anywhere to enable this, any help or insight would be very much appreciated.
There is a related question here How can I run a docker windows container on osx? but it's so old that is irrelevant and should not be a reason to lock this question.
Docker only runs natively on Linux machines because it needs Linux kernel features called namespaces and control groups. Docker containers are built from cut down Linux distributions.
The original solution to running Docker on OS X and Windows was Docker Toolkit. This was actually a Linux virtual machine running in the VirtualBox Hypervisor. The VM had Docker installed and could run containers.
Docker Desktop for Mac still makes use of a virtual machine running Linux running in the HyperKit Hypervisor. This virtual machine is lightweight and effectively hidden from the user.
Likewise Docker Desktop for Windows makes use of a virtual machine running in the Hyper-V Hypervisor. It can also run Windows containers.
To run Windows containers you need to have a Windows machine running Docker. The Windows machine can be virtual machine running on a Mac or Linux machine.
I know I am late to the party but as of 2021, this is the easiest setup to get a windows container running on macOS:
https://github.com/StefanScherer/windows-docker-machine
Install vagrant and virtual box
Clone the repository above and change directory into it
vagrant up --provider virtualbox 2019-box
docker context use 2019-box
I followed this setup and I could use the following windows image
mcr.microsoft.com/windows/servercore:ltsc2019
Please note that the windows version of your host must match the container image. This is mentioned here: https://hub.docker.com/_/microsoft-windows
Windows requires the host OS version to match the container OS
version. If you want to run a container based on a newer Windows
build, make sure you have an equivalent host build.

How can I run a docker windows container on osx?

I'm running docker for mac and want to start up a windows container. From what I see this should work via a virtual machine. But I'm unclear where to find out how to get it to work? Or does it only work for linux containers? Thanks in advance!
docker build nanoserver/
Sending build context to Docker daemon 2.56kB
Step 1/6 : FROM microsoft/nanoserver:10.0.14393.1480
10.0.14393.1480: Pulling from microsoft/nanoserver
bce2fbc256ea: Pulling fs layer
baa0507b781f: Pulling fs layer
image operating system "windows" cannot be used on this platform
I know I am late to the party but as of 2021, this is the easiest setup to get a windows container running on macOS:
https://github.com/StefanScherer/windows-docker-machine
Install vagrant and virtual box
Clone the repository above and change directory into it
vagrant up --provider virtualbox 2019-box
docker context use 2019-box
I followed this setup and I could use the following windows image
mcr.microsoft.com/windows/servercore:ltsc2019
Please note that the windows version of your host must match the container image. This is mentioned here: https://hub.docker.com/_/microsoft-windows
Windows requires the host OS version to match the container OS
version. If you want to run a container based on a newer Windows
build, make sure you have an equivalent host build.
See this link:
https://forums.docker.com/t/how-do-i-start-a-windows-docker-container-on-my-mac-os-x/12953/2
Text if you can't follow the link:
On OS X, get VirtualBox.
Get Windows Server 2016 Tech Preview 5 ISO167 (free download from Microsoft)
Create WS 2016 TP5 VM in virtualbox
Run this206 in the new VM
Now you can run Windows Containers in the VM. To make the setup a little easier to use, see this: https://forums.docker.com/t/windows-server-2016-tp5-docker-server-remote-management/10315/5317
You could also install Bootcamp on your machine which allows you to dual boot your computer between OS X and Windows 10. You could then use the full power of your hardware dedicated to Windows and docker instead of virtualization.
Additionally, you can make the use of VMWare Fusion for Mac OS or Parallels, which allow you to ALSO access the dual boot windows partition from within the Mac OS for maximum flexibility. During installation make sure you do not create a Virtual Machine drive, but instead access the bootcamp partition directly.

How to initialize and run Docker on windows?

I have Docker installed on Windows 7 platform. However when I try to run boot2docker start, the console gives me:
Failed to get machine 'boot2docker-vm': machine does not exist.
Ok, so I try to initialize the machine: boot2docker init. What now happens is even though I have the ISO image on the same path as docker, it tries to download a new image (and then fails to do so).
I uninstalled both OracleVM and GIT before installing them with boot2docker bundle as advised on Docker forums, but now I don't know how to proceed.
I had the same problem on a Windows 7 64 bit system when I installed the entire boot2docker package. It seems that running the solely 64-bit based boot2docker image from a 32-bit OS image (e.g. created by Virtualbox) does not work.
The solution for me was
to activate Intel Virtualisation Technolologies in my BIOS
(Lenovo X61 for me). Note that the settings can be found either
under CPU or Security.
choose a 64 bit OS version in VirtualBox and boot in with the
image obtained by boot2docker.
In case you're trying to do this now
For Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later), follow the instructions to install Docker Desktop here https://docs.docker.com/docker-for-windows/install/.
If you have Windows systems that do not meet the requirements of Docker Desktop for Windows(in my case Microsoft Windows 10 Home Single Language), you can install Docker Toolbox by following the instructions here https://docs.docker.com/toolbox/toolbox_install_windows/.
boot2docker does not support sharing directories on Windows IIRC. The way I run Docker on windows is:
install VirtualBox
install Vagrant
create a directory (let's say c:\vm\docker)
download this Vagrantfile and save it under c:\vm\docker\Vagrantfile
open a DOS command prompt
go to the directory cd c:\vm\docker
start the VM vagrant up and wait for it to install, start up and get provisionned
connect to the VM vagrant ssh
play with docker docker images, etc
Also you might want a real console instead of using the DOS command prompt:
install Git Bash for Windows
install Console
setup Console to use Git Bash (see this guide)
use Console to run the vagrant up and vagrant ssh commands

Resources