no network in vm after commit docker image and run on another server #97

Closed
opened 2025-12-28 23:24:13 +01:00 by adam · 3 comments
Owner

Originally created by @shifujun on GitHub (Jan 6, 2021).

I build and test a container well on a Ubuntu desktop, commit it and push. Then pull and run on another centos headless server.

But, in container(Arch Linux), curl work well. in macOS VM no network, include curl and nslookup.

How to debug this problem?

I noticed in README.md there is Then have QEMU on the host if you haven't already, does it relative? I don't understand why we need install QEMU on host while docker image include it?

Infos:

docker run -it --rm     --device /dev/kvm     -p 50922:10022     -e "DISPLAY=${DISPLAY:-:0.0}"     -e EXTRA="-monitor telnet::45454,server,nowait -nographic -serial null" customImage

[arch@4d6d8fa5d902 OSX-KVM]$ cat Launch.sh 
#!/bin/sh
set -eu
sudo chown    $(id -u):$(id -g) /dev/kvm 2>/dev/null || true
sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true
exec qemu-system-x86_64 -m ${RAM:-8}000 \
-cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \
-machine q35,accel=kvm:tcg \
-smp ${SMP:-4},cores=${CORES:-4} \
-usb -device usb-kbd -device usb-tablet \
-device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \
-drive if=pflash,format=raw,readonly,file=/home/arch/OSX-KVM/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd \
-smbios type=2 \
-audiodev ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \
-device ich9-ahci,id=sata \
-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \
-device ide-hd,bus=sata.2,drive=OpenCoreBoot \
-drive id=MacHDD,if=none,file=/home/arch/OSX-KVM/mac_hdd_ng.img,format=qcow2 \
-device ide-hd,bus=sata.4,drive=MacHDD \
-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900, -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:09:49:17 \
-monitor stdio \
-vga vmware \
${EXTRA:-}

Originally created by @shifujun on GitHub (Jan 6, 2021). I build and test a container well on a Ubuntu desktop, commit it and push. Then pull and run on another centos headless server. But, in container(Arch Linux), curl work well. in macOS VM no network, include curl and nslookup. How to debug this problem? I noticed in README.md there is `Then have QEMU on the host if you haven't already`, does it relative? I don't understand why we need install QEMU on host while docker image include it? Infos: ``` docker run -it --rm --device /dev/kvm -p 50922:10022 -e "DISPLAY=${DISPLAY:-:0.0}" -e EXTRA="-monitor telnet::45454,server,nowait -nographic -serial null" customImage [arch@4d6d8fa5d902 OSX-KVM]$ cat Launch.sh #!/bin/sh set -eu sudo chown $(id -u):$(id -g) /dev/kvm 2>/dev/null || true sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true exec qemu-system-x86_64 -m ${RAM:-8}000 \ -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \ -machine q35,accel=kvm:tcg \ -smp ${SMP:-4},cores=${CORES:-4} \ -usb -device usb-kbd -device usb-tablet \ -device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \ -drive if=pflash,format=raw,readonly,file=/home/arch/OSX-KVM/OVMF_CODE.fd \ -drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd \ -smbios type=2 \ -audiodev ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \ -device ich9-ahci,id=sata \ -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 \ -device ide-hd,bus=sata.2,drive=OpenCoreBoot \ -drive id=MacHDD,if=none,file=/home/arch/OSX-KVM/mac_hdd_ng.img,format=qcow2 \ -device ide-hd,bus=sata.4,drive=MacHDD \ -netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900, -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:09:49:17 \ -monitor stdio \ -vga vmware \ ${EXTRA:-} ```
adam closed this issue 2025-12-28 23:24:13 +01:00
Author
Owner

@sickcodes commented on GitHub (Jan 7, 2021):

--device /dev/kvm comes with qemu

@sickcodes commented on GitHub (Jan 7, 2021): `--device /dev/kvm` comes with qemu
Author
Owner

@shifujun commented on GitHub (Jan 7, 2021):

--device /dev/kvm comes with qemu

could you please elaborate?

@shifujun commented on GitHub (Jan 7, 2021): > `--device /dev/kvm` comes with qemu could you please elaborate?
Author
Owner

@shifujun commented on GitHub (Jan 14, 2021):

solved 🥳

The problem is we have multiple DNS server defined in Host, the first of them not working. I guess qemu just use the first one.

@shifujun commented on GitHub (Jan 14, 2021): solved 🥳 The problem is we have multiple DNS server defined in Host, the first of them not working. I guess qemu just use the first one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#97