I have Windows 10 Enterprise Version and I have installed Docker Desktop, enabled WSL2 backend, and downloaded and installed the Linux kernel update package.
I am learning Docker and I have some doubts about how Docker works behind the scenes.
- I have drawn a basic architecture diagram of Docker on windows with
WSL2, is this correct?
- Whenever we create a new Linux container it gets created in the same lightweight utility VM provided
- And if we create a windows container it gets created on windows os?
- Can these containers access windows and Linux kernels both when
required? Like when running a java app in a
Linux containerit requires windows kernel, right?
- So, by default docker runs Linux containers, when do we need windows containers? I can containerize a java application by using
openjdk:8, but I am not able to pull windows nanoserver image when I
run Linux containers, it works only when I switch to Windows
Containers. What is going on here? Does this mean the openjdk:8 image is a Linux image(i do not know how to say it), and windows nanoserver a windows image?
- How Linux Containers can run my java application? It must need the
windows kernel, right?
- If the docker containers reside within the lightweight utility VM
created by WSL2, can it access both the Linux kernel that it ships
with and the Windows Kernel?
I have the default
Linux container mode and I tried these two
- docker run –platform=linux -d ubuntu /bin/sh -c "while true; do echo
hello world; sleep 1; done"
- docker pull mcr.microsoft.com/windows/nanoserver:1903
The first one worked for the second one I got the following error.
1903: Pulling from windows/nanoserver no matching manifest for Linux/amd64 in the manifest list entries
But when I switch to
windows containers it works.
- So what is the difference between my java app on openjdk:8 image and windows nanoserver?
- Do these not require windows kernel to run?
- How is the java thing running on Linux containers then?
Source: Docker Questions