Docker containers in Windows "look" like VMs...

  • Python
  • Thread starter fog37
  • Start date
  • Tags
    Windows
  • #1
fog37
1,549
107
Hello,

I am trying to better understand how Docker works under the hood in Windows...I get the difference between virtual machines (guest OS on top of a host OS) and containers (which work with the host OS)...The Docker desktop installation process seems to automatically install both Hyper V and WSL 2 (which is different from WSL1...Hyper V a type of lightweight hypervisor to run and manage virtual machines and WSL2 is really a Linux OS virtual machine... If so, then running Docker in Windows seems to be like running a virtual machine and not a container..

IF the Dockerfile first line is FROM python :3, it means that we are instructing the docker engine to go on Docker hub and downloaed a Docker parent image containing the interpreter python as well as the Linux distribution Alpine....I get Docker is truly a linux application. Now we have both the Alpine Linux distribution and WSL2 which seem to be two Linux operating systems...Again, that looks more like a virtual machine than a container: we have Windows (our host OS), Alpine, and WSL2...

Thank you!
 
Technology news on Phys.org
  • #2
Docker is a linux technology that runs on windows and macos. On Linux, it takes advantage of some Linux security protections to run code in a sort of sandbox using the same OS. This makes Docker containers very light-weight and reduces system resource usage on a Linux host.

When running on Windows there has to be a VM to run Docker inside. Windows provides the WSL subsystem for that and it is a VM that looks like a linux environment to Docker. It was quite "inspired" by MS to offer this but I guess they saw the writing on the wall with developers bouncing between the two environments. I know they resisted this approach for a long time forcing people to have two machines, or log into a linux machine or use dual boot...

https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

One thing that I found cool was that the MS VS code editor works in both environments via a web service that runs inside the WSL environment and does the CRLF conversion seamlessly between them. It allows developers to span the environments much more easily.
 
  • #3
It is probably worth pointing out that the distinction between "sandbox' and "full virtual machine" is also a matter of degree. The CPU is still executing the instructions like it always did.
 
  • #4


I use Docker to run a specific Home Assistant Linux 'environment' on a general Linux server that handles other networking and processing capabilities for the programs running inside the Docker 'environment'.
 
  • #5
Vanadium 50 said:
It is probably worth pointing out that the distinction between "sandbox' and "full virtual machine" is also a matter of degree. The CPU is still executing the instructions like it always did.
Yes, this brings up an interesting scenario. Commodore 64 family of machines are emulated in the VICE application. Its like a VM that executes 6502 code on any machine hosting VICE. That means that the 6502 code is "translated" in equivalent machine code of the host machine to run. They even simulate the Commodore address space for peeks and pokes.

I would consider VICE a full blown VM vs something like WSL that runs linux on Windows where the opcodes of the image are the same as the host ie you wouldn't install an Apple M2 linux image on WSL if it is running on an Intel processor since the opcodes are different.
 

Similar threads

  • Programming and Computer Science
Replies
1
Views
286
  • Programming and Computer Science
Replies
13
Views
2K
  • Programming and Computer Science
Replies
5
Views
892
Back
Top