Jak rozpoznać i debugować aplikacje działającą w Windows Container / How to recognize and debug applications running in Windows Container

Kontenerami na Windowsa wszyscy mogą się pobawić od czasu konferencji Ignite 2016 – swojego czasu pokazywałem to jako nowość – https://channel9.msdn.com/Series/Nowosci-z-konferencji-Microsoft-Ignite-2016-Kontenery-Device-Guard-Shielded-VMs-Nested-Virtualizatio/02-Troche-praktyki-kontenery. Na Windows Serwer kontenery możemy uruchomić w dwóch trybach Hyper-V i tzw. Windows Server Container. W pierwszym wypadku jądro systemu uruchomione jest jako maszyna wirtualna na Hyper-V i w takim przypadku możemy uruchomiać kontenery Linuxowe na Windows. W drugim wypadku nie mamy warstwy wirtualizacji, mimo odizolowania procesów – wątków aplikacji, jak i samego systemu plików. Jak zatem widzimy owe procesy na hoście? Patrz Screenshot 1 – Po dodaniu kolumny Session widzimy, że aplikacje działające w kontenerze mają numer sesji 3, a numer 2 przyporządkowany jest dla aplikacji działających na hoście.
Jak zatem widzimy dostęp do dysku, z poziomu hosta? Przedstawia to Screenshot 2 z uruchomionym Process Monitorem na hoście, gdzie widzimy, że aplikacje działające w kontenerze nie zapisują do ścieżki typu c:\nazwa katalogu, a do \Device\Harddisk.

Mając na uwadze powyższe – warto wiedzieć, iż aplikacje działające w Windows Container możemy monitorować z poziomu Hosta – a nie kontenera!

 

 

Since Ignite 2016 conference everyone can use Windows Containers (https://channel9.msdn.com/Series/Nowosci-z-konferencji-Microsoft-Ignite-2016-Kontenery-Device-Guard-Shielded-VMs-Nested-Virtualizatio/02-Troche-praktyki-kontenery). On Windows Server, containers can be run in two modes Hyper-V and Windows Server Container. In the first case, the kernel is running as a virtual machine on Hyper-V and in this case we can run Linux containers on Windows. In the second case, we do not have a virtualization layer, despite isolating of processes of the application, as well as the file system. So how do we see these processes on the host? See Screenshot 1 – After adding the Session column, we see that the applications running in the container have session number 3, and the number 2 is assigned to applications running on the host.
How do we see disk access from the host level? This is presented in Screenshot 2 with the Process Monitor on the host running, where we see that the applications running in the container do not write to the path type c: \directory name, but to \Device\Harddisk.

Having in mind the above – it is worth knowing that applications running in Windows Container can be monitored from the Host level – not a container!