sickcodes / Docker-OSX

Run macOS VM in a Docker! Run near native OSX-KVM in Docker! X11 Forwarding! CI/CD for OS X Security Research! Docker mac Containers.
https://hub.docker.com/r/sickcodes/docker-osx
GNU General Public License v3.0
36.13k stars 1.78k forks source link

Can Docker-OSX save a running state on disk ? #220

Open bhzhu203 opened 3 years ago

bhzhu203 commented 3 years ago

Seems that Docker-OSX has permance issue : Startup is slow ,it takes 5 mins+ to complete the system startup to see the whole desktop. But after the completed startup everything becomes more smooth.

The CPU usage of host system is low ,the CPU useage of qemu process is often blow 100%(8core CPU,800%) .Memory is not be fully used in guest system(memory used in 1.8G,cache in file 3.8G,swap??But host system has 16G mem ,12G mem in qemu process ). Disk IO is showed low in iotop on host system.

Docker-OSX is based on qemu ,I know qemu can save guest system running status. Could Docker-OSX add this feature ? And disable swap in OSX ? I can not bear this slow startup speed and lag UI control in OSX big-sur . Thanks

❯ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 60 Model name: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz Stepping: 3 CPU MHz: 1720.770 CPU max MHz: 4400.0000 CPU min MHz: 800.0000 BogoMIPS: 7995.29 Virtualization: VT-x L1d cache: 128 KiB L1i cache: 128 KiB L2 cache: 1 MiB L3 cache: 8 MiB NUMA node0 CPU(s): 0-7 Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable Vulnerability Mds: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable Vulnerability Meltdown: Mitigation; PTI Vulnerability Spec store bypass: Vulnerable Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Vulnerable, STIBP: disabled Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx e st tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_s ingle pti tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm xsaveopt dtherm ida ara t pln pts

❯ lspci 00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06) 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:01.1 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x8 Controller (rev 06) 00:14.0 USB controller: Intel Corporation 9 Series Chipset Family USB xHCI Controller 00:16.0 Communication controller: Intel Corporation 9 Series Chipset Family ME Interface #1 00:19.0 Ethernet controller: Intel Corporation Ethernet Connection (2) I218-V 00:1a.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #2 00:1b.0 Audio device: Intel Corporation 9 Series Chipset Family HD Audio Controller 00:1c.0 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 1 (rev d0) 00:1c.3 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d0) 00:1d.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1 00:1f.0 ISA bridge: Intel Corporation 9 Series Chipset Family Z97 LPC Controller 00:1f.2 SATA controller: Intel Corporation 9 Series Chipset Family SATA Controller [AHCI Mode] 00:1f.3 SMBus: Intel Corporation 9 Series Chipset Family SMBus Controller 02:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 3GB] (rev a1) 02:00.1 Audio device: NVIDIA Corporation Device 10f1 (rev a1) 04:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 04)

uname -a \

; echo "${DISPLAY}" \ ; echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs \ ; grep NAME /etc/os-release \ ; df -h . \ ; qemu-system-x86_64 --version \ ; libvirtd --version \ ; free -mh \ ; nproc \ ; egrep -c '(svm|vmx)' /proc/cpuinfo \ ; ls -lha /dev/kvm \ ; ls -lha /tmp/.X11-unix/ \ ; ps aux | grep dockerd \ ; docker ps | grep osx \ ; grep "docker|kvm|virt" /etc/group Linux bhzhuos 5.3.7-uksm #2 SMP Fri Oct 25 01:09:57 CST 2019 x86_64 GNU/Linux :0.0 1 grep: /etc/os-release: No such file or directory Filesystem Size Used Avail Use% Mounted on /dev/sdc3 781G 335G 445G 43% /home QEMU emulator version 5.2.0 Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers bash: libvirtd: command not found total used free shared buff/cache available Mem: 15G 9.6G 1.0G 207M 5.0G 4.2G Swap: 1.0G 19M 1.0G 8 8 crw-rw----+ 1 root kvm 10, 232 Mar 23 20:35 /dev/kvm total 0 drwxrwxrwt 2 root root 60 Mar 11 10:27 . drwxrwxrwt 26 root root 880 Mar 24 10:15 .. srwxrwxrwx 1 root root 0 Mar 8 20:42 X0 root 30259 0.2 0.2 1862708 35164 ? Sl Mar19 14:33 /usr/bin/dockerd -g /home/tmp/docker -s overlay2 --registry-mirror=https://hw.mirror.aliyuncs.com root 45531 0.0 0.0 19280 2244 pts/0 S+ 10:15 0:00 grep --color=auto dockerd 866976966c35 sickcodes/docker-osx:big-sur "/bin/bash -c 'sudo …" 24 hours ago Up 14 hours 0.0.0.0:50922->10022/tcp big-sur kvm:x:61:bhzhu

sickcodes commented 3 years ago

There are many options to change RAM and CPU allocation in the readme