Coder Social home page Coder Social logo

qemus / qemu-docker Goto Github PK

View Code? Open in Web Editor NEW
366.0 13.0 43.0 729 KB

QEMU in a Docker container.

License: MIT License

Dockerfile 2.45% Shell 87.92% HTML 2.15% CSS 3.51% JavaScript 3.98%
docker docker-image kvm kvm-hypervisor qemu qemu-kvm virtual-machine virtualization

qemu-docker's Introduction

QEMU

Build Version Size Package Pulls

Docker container for running virtual machines using QEMU.

Features ✨

  • Web-based viewer to control the machine directly from your browser

  • Supports .iso, .img, .qcow2, .vhd, .vhdx, .vdi, .vmdk and .raw disk formats

  • High-performance options (like KVM acceleration, kernel-mode networking, IO threading, etc.) to achieve near-native speed

Usage 🐳

Via Docker Compose:

services:
  qemu:
    container_name: qemu
    image: qemux/qemu-docker
    environment:
      BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-virt-3.19.1-x86_64.iso"
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
    stop_grace_period: 2m

Via Docker CLI:

docker run -it --rm -e "BOOT=http://example.com/image.iso" -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN qemux/qemu-docker

Via Kubernetes:

kubectl apply -f kubernetes.yml

FAQ πŸ’¬

How do I use it?

Very simple! These are the steps:

  • Set the BOOT environment variable to the URL of any disk image you want to install.

  • Start the container and connect to port 8006 using your web browser.

  • You will see the screen and can now install the OS of your choice using your keyboard and mouse.

Enjoy your brand new machine, and don't forget to star this repo!

How do I change the storage location?

To change the storage location, include the following bind mount in your compose file:

volumes:
  - /var/qemu:/storage

Replace the example path /var/qemu with the desired storage folder.

How do I change the size of the disk?

To expand the default size of 16 GB, add the DISK_SIZE setting to your compose file and set it to your preferred capacity:

environment:
  DISK_SIZE: "128G"

Tip

This can also be used to resize the existing disk to a larger capacity without any data loss.

How do I boot a local image?

You can use a local image file directly, and skip the download altogether, by binding it in your compose file:

volumes:
  - /home/user/example.iso:/boot.iso

This way you can supply a boot.iso, boot.img or boot.qcow2 file.

Note

The URL of the BOOT variable will be ignored in this case.

How do I boot ARM images?

You can use qemu-arm to run ARM64-based images.

How do I boot Windows?

Use dockur/windows instead, as it includes all the drivers required during installation, amongst many other features.

How do I boot macOS?

Use dockur/macos instead, as it uses all the right settings and automaticly downloads the installation files.

How do I boot without VirtIO drivers?

By default, the machine makes use of virtio-scsi drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for other operating systems.

If your machine fails to detect the hard drive, you can modify your compose file to use virtio-blk instead:

environment:
  DISK_TYPE: "blk"

Tip

If it still fails to boot, you can set the value to ide to emulate a IDE drive, which is slow but requires no drivers and is compatible with almost every system.

How do I change the amount of CPU or RAM?

By default, the container will be allowed to use a maximum of 1 CPU core and 1 GB of RAM.

If you want to adjust this, you can specify the desired amount using the following environment variables:

environment:
  RAM_SIZE: "4G"
  CPU_CORES: "4"

How do I verify if my system supports KVM?

To verify that your system supports KVM, run the following commands:

sudo apt install cpu-checker
sudo kvm-ok

If you receive an error from kvm-ok indicating that KVM acceleration can't be used, please check whether:

  • the virtualization extensions (Intel VT-x or AMD SVM) are enabled in your BIOS.

  • you are running an operating system that supports them, like Linux or Windows 11 (macOS and Windows 10 do not unfortunately).

  • you enabled "nested virtualization" if you are running the container inside a virtual machine.

  • you are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's.

If you didn't receive any error from kvm-ok at all, but the container still complains that /dev/kvm is missing, it might help to add privileged: true to your compose file (or --privileged to your run command), to rule out any permission issue.

How do I assign an individual IP address to the container?

By default, the container uses bridge networking, which shares the IP address with the host.

If you want to assign an individual IP address to the container, you can create a macvlan network as follows:

docker network create -d macvlan \
    --subnet=192.168.0.0/24 \
    --gateway=192.168.0.1 \
    --ip-range=192.168.0.100/28 \
    -o parent=eth0 vlan

Be sure to modify these values to match your local subnet.

Once you have created the network, change your compose file to look as follows:

services:
  qemu:
    container_name: qemu
    ..<snip>..
    networks:
      vlan:
        ipv4_address: 192.168.0.100

networks:
  vlan:
    external: true

An added benefit of this approach is that you won't have to perform any port mapping anymore, since all ports will be exposed by default.

Important

This IP address won't be accessible from the Docker host due to the design of macvlan, which doesn't permit communication between the two. If this is a concern, you need to create a second macvlan as a workaround.

How can the VM acquire an IP address from my router?

After configuring the container for macvlan, it is possible for the VM to become part of your home network by requesting an IP from your router, just like a real PC.

To enable this mode, add the following lines to your compose file:

environment:
  DHCP: "Y"
devices:
  - /dev/vhost-net
device_cgroup_rules:
  - 'c *:* rwm'

Note

In this mode, the container and the VM will each have their own separate IPs.

How do I add multiple disks?

To create additional disks, modify your compose file like this:

environment:
  DISK2_SIZE: "32G"
  DISK3_SIZE: "64G"
volumes:
  - /home/example:/storage2
  - /mnt/data/example:/storage3

How do I pass-through a disk?

It is possible to pass-through disk devices directly by adding them to your compose file in this way:

devices:
  - /dev/sdb:/disk1
  - /dev/sdc:/disk2

Use /disk1 if you want it to become your main drive, and use /disk2 and higher to add them as secondary drives.

How do I pass-through a USB device?

To pass-through a USB device, first lookup its vendor and product id via the lsusb command, then add them to your compose file like this:

environment:
  ARGUMENTS: "-device usb-host,vendorid=0x1234,productid=0x1234"
devices:
  - /dev/bus/usb

How can I provide custom arguments to QEMU?

You can create the ARGUMENTS environment variable to provide additional arguments to QEMU at runtime:

environment:
  ARGUMENTS: "-device usb-tablet"

What image formats are supported?

The BOOT URL accepts files in any of the following formats:

Extension Format
.img Raw
.raw Raw
.iso Optical
.qcow2 QEMU
.vmdk VMware
.vhd VirtualPC
.vhdx Hyper-V
.vdi VirtualBox

Tip

It will also accept .img.gz, .qcow2.xz, .iso.zip and many more, as it automaticly extracts compressed files.

Stars 🌟

Stars

qemu-docker's People

Contributors

joshkunz avatar kroese avatar natechoe1 avatar r0gger avatar renovate-bot avatar renovate[bot] avatar vice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qemu-docker's Issues

[Feature]: Add an easier way to run preinstalled images.

Is there no existing feature request for this?

  • I have searched the existing feature requests

Is your proposal related to a problem?

I found existing issues #347, #458 but I think this use case is slightly different.
Some systems ship as a preinstalled qcow2 image (for example home assistant, https://www.home-assistant.io/installation/linux)

In such case it's needed to mount the provided file as data.qcow2, instead of installing an iso. However, the script seems to always expect the boot env var to be set, or an installer image to exist.

Describe the solution you'd like.

Maybe the BOOT variable could recognise a special keyword, like skip, preinstalled, that would skip adding the CDROM, and trying to download an image?
Or it could maybe be a new variable, like PREINSTALLED|INSTALLED=y?

Describe alternatives you've considered.

Creating a dummy boot.img|iso file in /storage, seems to be working as a workaround.

Additional context

Thank you for this project, it's very useful :)

Error mount a linux iso

Is there no existing issue for this?

  • I have searched the existing issues

Machine specifications

NUC13ANHi5 13th Gen Intel i5-1340P (16) @ 1.900GHz Ram 16GB

Operating system

Debian 12

Docker version

Docker version 20.10.24+dfsg1, build 297e128

Description

I can't mount a linux iso.

This is :

$ file linux.iso
linux.iso: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x32,253,11), startsector 1, 819199 sectors, extended partition table (last)

$ sudo fdisk -l linux.iso
Disk linux.iso: 400 MiB, 419430400 bytes, 819200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 82052885-6927-4E5D-B11E-4B907E7C9FEA

Docker compose

services:
qemu:
container_name: qemu
image: qemux/qemu-docker
environment:
RAM_SIZE: "4G"
CPU_CORES: "4"
DISK_SIZE: "4G"
DEBUG: "Y"
volumes:
- ./linux.iso:/boot.iso
- ./storage:/storage
devices:
- /dev/kvm
cap_add:
- NET_ADMIN
ports:
- 8006:8006
stop_grace_period: 2m

Docker log

Attaching to qemu
�[36mqemu |�[0m ❯ Starting QEMU for Docker v5.04...
�[36mqemu |�[0m ❯ For support visit https://github.com/qemus/qemu-docker
�[36mqemu |�[0m ❯ CPU: 13th Gen Intel Core TM i5 1340P | RAM: 10/16 GB | DISK: 212 GB (ext4) | HOST: 6.9.0-x64v3-xanmod1...
οΏ½[36mqemu |οΏ½[0m
�[36mqemu |�[0m �[1;34m❯ �[1;36mCreating a 4G growable disk image in raw format...�[0m
�[36mqemu |�[0m �[1;34m❯ �[1;36mHost: 4e6ead9064c6 IP: 192.168.112.2 Gateway: 192.168.112.1 Interface: eth0 MAC: 02:F2:CC:5E:11:4F�[0m
οΏ½[36mqemu |οΏ½[0m nameserver 127.0.0.11
οΏ½[36mqemu |οΏ½[0m
οΏ½[36mqemu |οΏ½[0m ++ /usr/sbin/dnsmasq --dhcp-range=20.20.20.21,20.20.20.21 --dhcp-host=02:F2:CC:5E:11:4F,,20.20.20.21,QEMU,infinite --dhcp-option=option:netmask,255.255.255.0 --dhcp-option=option:dns-server,20.20.20.1 --dhcp-option=option:router,20.20.20.1 --address=/host.lan/20.20.20.1
οΏ½[36mqemu |οΏ½[0m
�[36mqemu |�[0m �[1;34m❯ �[1;36mBooting image...�[0m
οΏ½[36mqemu |οΏ½[0m + exec qemu-system-x86_64 -nodefaults -cpu host,kvm=on,l3-cache=on,migratable=no -smp 4,sockets=1,dies=1,cores=4,threads=1 -m 4G -machine type=q35,smm=off,graphics=off,vmport=off,dump-guest-core=off,hpet=off,accel=kvm -enable-kvm -global kvm-pit.lost_tick_policy=discard -display vnc=:0,websocket=5700 -vga virtio -monitor telnet:localhost:7100,server,nowait,nodelay -name qemu,process=qemu,debug-threads=on -serial mon:stdio -device qemu-xhci,id=xhci -device usb-tablet -netdev tap,ifname=qemu,script=no,downscript=no,id=hostnet0 -device virtio-net-pci,romfile=,netdev=hostnet0,mac=02:F2:CC:5E:11:4F,id=net0 -object iothread,id=io2 -drive id=cdrom0,media=cdrom,if=none,format=raw,readonly=on,file=/boot.iso -device virtio-scsi-pci,id=scsi0,iothread=io2,addr=0x5 -device scsi-cd,bus=scsi0.0,drive=cdrom0,bootindex=10 -drive file=/storage/data.img,if=none,id=drive-userdata3,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on -device virtio-scsi-pci,id=hw-userdata3,iothread=io2,bus=pcie.0,addr=0xa -device scsi-hd,bus=hw-userdata3.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata3,id=userdata3,rotation_rate=1,bootindex=3 -object rng-random,id=objrng0,filename=/dev/urandom -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c -device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4
οΏ½[36mqemu |οΏ½[0m οΏ½cοΏ½[?7lοΏ½[2JοΏ½[0mSeaBIOS (version 1.16.3-debian-1.16.3-2)
οΏ½[36mqemu |οΏ½[0m Booting from Hard Disk...
οΏ½[36mqemu |οΏ½[0m Boot failed: not a bootable disk
οΏ½[36mqemu |οΏ½[0m
οΏ½[36mqemu |οΏ½[0m Booting from DVD/CD...
οΏ½[36mqemu |οΏ½[0m Boot failed: Could not read from CDROM (code 0005)
οΏ½[36mqemu |οΏ½[0m Booting from Floppy...
οΏ½[36mqemu |οΏ½[0m Boot failed: could not read the boot disk
οΏ½[36mqemu |οΏ½[0m
οΏ½[36mqemu |οΏ½[0m No bootable device.
Gracefully stopping... (press Ctrl+C again to force)

Screenshots (optional)

tempImageEVp6Mo

Ability to change internal NoVnc port

Is your proposal related to a problem?

As the topic say,

Can you put a variable to be driven in the docker-compose to be able to change internal listening port of novnc? I ask because yesterday I wanted to try proxmox but at the end installation I had to reach port 8006 but it was already occupied by novnc.

Describe the solution you'd like.

.

Describe alternatives you've considered.

.

Additional context

No response

QEmu can't stay up

Hi !

Tried in docker compose the default configuration, with and without BOOT_MODE: "uefi"; even without any added option and the container can't stay up. I don't know how to launch it.

How can use an iso on local server HDD ? Tried BOOT: "/srv/dev-disk-by-uuid-17a832c5-e23e-471d-a423-516ecbb18a10/Splinter/Isos/OS/Windows_98_SE.iso", and volume : /srv/dev-disk-by-uuid-17a832c5-e23e-471d-a423-516ecbb18a10/Splinter/Isos/OS/:/os to have folder in qemu if possible (don't know because I even don't know what it looks like)

Thanks !

[Question]: tutorial for *.img.gz

Is your question not already answered in the FAQ?

  • I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • I am sure my question is not about a technical issue.

Question

Hello, i like the idea of the qemu in a docker. But its different for a beginner like me compared to the native qemu. My goal is to run things like Libre Elec in it (images like *img.gz, that arent *.iso). I get it running in the native qemu by converting it into qcow2, but in your version it starts booting only to a certain point and then gets stuck. Perhaps u can add a few steps and cli-commands in your description, how to get such an image running?

Thank you and keep up the great work

Cannot seem to use a local windows iso file

Hi i have a local windows iso that i would like to use but i cannot get it working, alpine linux booted as normal so i read your readme and change option to windows and place a boot.iso to my /storage drive but it cannot seem to boot.

Cloud-init support

It would be awesome to incorporate Cloud-init support for noninteractive, declarative installs.

[Question]: vnc

Is your question not already answered in the FAQ?

  • I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • I am sure my question is not about a technical issue.

Question

Good afternoon!
Is it possible to install a VNC server in the container so that we can use a Windows VM through a VNC client instead of a browser? Thank you!

How to interact with OS run by qemu-kvm

How do I interact with the OS run by kvm? I see that on terminal it asks for login but write root and enter but no password request. I also tried with picocom on /dev/ttyS0 but no luck.

"Display output is not active" when trying to run `android-x86_64-9.0-r2-k49.iso` live

When using

android-x86_64-9.0-r2-k49.iso as image (stored locally under ~/storage/boot.img)

after choosing to run live at the graphical prompt, displays briefly:

"Display output is not active"

then returns to CLI showing:

[    0.055895] core perfectr but no constraints; unknown hardware!
Detecting Android-x86... found at /dev/sr0

console:/ #

and the graphical booting does not proceed further

No image download

I tried your contianer on my debian11 OS (J4105 CPU, KVM ready) with this result.
Do you have some suggestions?
thanks

gianpi@omv/Data/compose/network$ sudo docker-compose up qemu
[+] Running 1/0
βœ” Container qemu Created 0.0s
Attaching to qemu
qemu | ❯ Starting QEMU for Docker v2.20...
qemu | ❯ Downloading "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso" as boot image...
qemu | ❯ ERROR: Failed to download "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso", reason: 1
qemu exited with code 0

KVM acceleration not detected

Im testing with this image.
Following specifications, i include it in my docker-compose.yml.

# docker-compose.yml
version: "3.9"

services:
    rest:
         #...
    appium:
          #...
    qemu:
        image: qemux/qemu-docker:latest
        stop_grace_period: 1m
        container_name: qemu
        restart: on-failure
        privileged: true
        environment:
            # DISK_SIZE: "32G"
            ALLOCATE: "N"
            BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso"
        devices:
            - /dev/kvm
            - /dev/vhost-net
        cap_add:
            - ALL
        ports:
            - 22:22
    android:
        container_name: android
        privileged: true
        env_file: .env
        image: android
        command: opt/android-sdk-linux/emulator/emulator -avd test -netdelay none -netspeed full -no-window -no-audio -no-boot-anim -no-snapshot
        build:
            context: .
            dockerfile: dockerfile
            target: android

networks:
    vlan:
        external: true

And when i run it with docker compose up --build i get the following error:

[+] Building 0.9s (11/11) FINISHED                                                                                                                    
[+] Running 2/2
 βœ” Container android  Created                                                                                                                    0.0s 
 βœ” Container qemu     Recreated                                                                                                                  0.1s 
Attaching to android, qemu
qemu     | ❯ Starting QEMU for Docker v2.20...
qemu     | ❯ ERROR: KVM acceleration not detected (device file missing), see the FAQ about this.
android exited with code 0
qemu exited with code 0

In my pc i checked kvm using kvm-ok and is okey.

OS: Ubuntu 22.04

[Bug]: /run/entry.sh: line 20: qemu-system-aarch64: command not found

Operating system

debian 12.5

Description

qemu-system-aarch64: command not found

Docker compose

services:
  qemu:
    container_name: qemu-debian
    image: qemux/qemu-docker
    networks:
      vlan:
        ipv4_address: 192.168.10.230
    environment:
      BOOT_MODE: "uefi"
      DISK_SIZE: "128G"
      DISK_FMT: "qcow2"
      RAM_SIZE: "8G"
      CPU_CORES: "8"
     BOOT: "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso"
    volumes:
      - /media/BACKUP/ISO/os/debian12install.iso:/boot.iso
      - ./storage:/storage
    devices:
      - /dev/kvm
      - /dev/bus/usb
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
    stop_grace_period: 2m
    restart: unless-stopped

networks:
  vlan:
    external: true

Docker log

Starting QEMU for Docker v5.10...
❯ For support visit https://github.com/qemus/qemu-docker
❯ CPU: 13th Gen Intel Core TM i5 1340P | RAM: 51/63 GB | DISK: 126 GB (ext4) | HOST: 6.9.3-x64v3-xanmod1...
/run/entry.sh: line 20: qemu-system-aarch64: command not found

Screenshots (optional)

No response

Boot from disk after installation not working

Hi!
We tried to set up QEMU to imitate a small industrial PC with two hard drives on a Windows computer (Windows 10 without KVM, and Windows 11 with KVM). The installation from our .iso to the first hard drive worked perfectly fine. However, after the installation, when restarting the docker container, we can't boot from the installed system.

We start the docker container with this modified docker-compose.yml:

version: "3"
services:
  qemu:
    container_name: qemu
    image: qemux/qemu-docker
    environment:
      BOOT: "/storage/boot.iso"
      DISK_SIZE: "16G"
      DISK2_SIZE: "16G"
      BOOT_MODE: "uefi"
      RAM_SIZE: "6G"
      CPU_CORES: "8"
      DISK_FMT: "raw"
      ARGUMENTS: "-smbios type=1"
    volumes:
      - ./storage:/storage
      - ./storage2:/storage2
    devices:
       - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
    stop_grace_period: 2m
    restart: on-failure

After installation and restart, the boot manager shows all boot options in the correct order:

(1) UEFI QEMU QEMU HARDDISK (with the installed Debian system)
(2) UEFI QEMU QEMU HARDDISK 2 (empty)
(3) UEFI QEMU QEMU CD-ROM (customized Debian live system with installer).

However, even if we select the first option manually, it always falls back to the installer.

If we use the raw .img files for hard drives 1 and 2 to run QEMU manually in WSL (with Debian 12), we can start up the system without trouble. Only in the docker container it does not work.

As a workaround, we can comment out line 23 from /src/disk.sh (DISK_OPTS="$DISK_OPTS -device ide-cd,drive=cdrom0,bootindex=$BOOT_INDEX"), to get rid of the CD-ROM option. If we do this, we can boot into the installed system as intended.

Do you have any suggestions as to why this could happen? Thanks!

Security Issue: Requires Root Privs

Operating system

Parabola GNU/Linux-libre

Description

I have my user added to the kvm group, and also rootless podman is setup, it should work without root privs.

Dockerfile

FROM scratch
COPY --from=qemux/qemu-docker:5.16 / /

ARG VERSION_ARG="0.0"
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NONINTERACTIVE_SEEN="true"

RUN set -eu && \
    apt-get update && \
    apt-get --no-install-recommends -y install \
        bc \
        curl \
        7zip \
        wsdd \
        samba \
        xz-utils \
        wimtools \
        dos2unix \
        cabextract \
        genisoimage \
        libxml2-utils && \
    apt-get clean && \
    echo "$VERSION_ARG" > /run/version && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --chmod=755 ./src /run/
COPY --chmod=755 ./assets /run/assets

ADD --chmod=755 https://raw.githubusercontent.com/christgau/wsdd/v0.8/src/wsdd.py /usr/sbin/wsdd
ADD --chmod=664 https://github.com/qemus/virtiso/releases/download/v0.1.248/virtio-win-0.1.248.tar.xz /drivers.txz

EXPOSE 8006 3389
VOLUME /storage

ENV RAM_SIZE "4G"
ENV CPU_CORES "2"
ENV DISK_SIZE "64G"
ENV VERSION "win11"

ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]

Docker log

❯ ERROR: Script must be executed with root privileges.

Screenshots (optional)

No response

How can I set up the instance as a bypass route?

In the macvlan mode, I attempted to use the container's IP as the gateway for other devices, allowing them to access the internet successfully. However, the transparent proxy service deployed on this container instance does not seem to function. Is it possible that internet requests are not being forwarded to the virtual machine instance? How can I set up the instance as a bypass route?

dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device

Operating system

Synology DSM

Description

Planed to run a local ubuntu iso in Synology, but the container failed to start.

Docker compose

services:
qemu-ubuntu:
container_name: qemu-ubuntu
image: qemux/qemu-docker
restart: unless-stopped
devices:
- /dev/kvm
cap_add:
- NET_ADMIN
ports:
- 8006:8006
volumes:
- /volume1/docker/qemu-ubuntu/storage:/storage
- /volume1/OS/ubuntu-24.04-desktop-amd64.iso:/boot.iso
environment:
DISK_SIZE: "128G"
RAM_SIZE: "8G"
CPU_CORES: "4"
stop_grace_period: 2m

Docker log

dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device
❯ ERROR: Failed to start dnsmasq, reason: 0
❯ Starting QEMU for Docker v5.08...
❯ For support visit https://github.com/qemus/qemu-docker
❯ CPU: Intel Core TM i5 8600T CPU | RAM: 49/63 GB | DISK: 633 GB (btrfs) | HOST: 4.4.302+...

dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device
❯ ERROR: Failed to start dnsmasq, reason: 0
❯ Starting QEMU for Docker v5.08...
❯ For support visit https://github.com/qemus/qemu-docker
❯ CPU: Intel Core TM i5 8600T CPU | RAM: 49/63 GB | DISK: 633 GB (btrfs) | HOST: 4.4.302+...

dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device
❯ ERROR: Failed to start dnsmasq, reason: 0
❯ Starting QEMU for Docker v5.08...
❯ For support visit https://github.com/qemus/qemu-docker
❯ CPU: Intel Core TM i5 8600T CPU | RAM: 49/63 GB | DISK: 632 GB (btrfs) | HOST: 4.4.302+...

Screenshots (optional)

No response

Compose or docker compose file doesn't contain version

Operating system

ubuntu 18.04

Description

When I run it I has this error mention in the docker compose.
I assume I'm running a different docker version that this has been developed on?

Docker compose

docker-compose build
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services: 'qemu'

Docker log

no log

Screenshots (optional)

No response

[Question]: Setting QEMU resolution Flag

Is your proposal related to a problem?

It would be beneficial to have the ability to scale up/down the resolution of the VNC display.

Describe the solution you'd like.

Document how to properly set a flag to docker/compose to specify VNC QEMU resolution parameters as e.g. -device qxl-vga,xres=1024,yres=768

Describe alternatives you've considered.

Working with the native resolution.

Additional context

N/A

[Question]: How to generate an ISO of a running container with app and files?

Is your question not already answered in the FAQ?

  • I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • I am sure my question is not about a technical issue.

Question

Is it feasible to request that the container create an ISO image (such as qemus_disk.iso?) of a running setup container with apps and files?

No HDD to install Windows is found

Hi there!

I'm testing dockur and qemu-docker projects on WSL2.
I tried using custom ISO with qemu-docker and encountered an issue with Windows setup, while dockur containers run just fine.
I am running it on the same machine with almost same options as in dockur, but when Windows installation process begins, the following sequence of error occurs:

  1. A media driver your computer needs is missing.
    ...
  2. No device drivers were found. Make sure that the installation media contains the correct drivers, then click OK.
    2c3feae2-b310-478d-beed-12abd692a8b4
    69db188f-e165-4f1e-bb8e-cae662718dbd

It says that there is no driver, but it seems the setup tool doesn't see the HDD to install the Windows on.
When I enter console mode (Shift+10), diskpart , commands list disks and list vol show "There are no fixed disks to show" and "There are no volumes" respectively.
I've recreated the Ubuntu in WSL and installed dockur and qemu-docker from scratch just today and tried using the original Windows ISO image without any customizations to sort out any issues and the error persists.

Below is my docker-compose.yml for qemu-docker.

version: "3"
services:
  qemu:
    container_name: qemu
    image: qemux/qemu-docker
    environment:
      environment:
      RAM_SIZE: "2G"
      CPU_CORES: "2"
      DISK_SIZE: "20G"
      BOOT: "https://software.download.prss.microsoft.com/dbazure/Win10_22H2_EnglishInternational_x64v1.iso"
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
    stop_grace_period: 2m
    restart: on-failure

Can you advice if my setup is missing something that makes qemu not see the virtual HDD? Thanks.

[Question]: How do i connect into SSH and VNC?

Is your question not already answered in the FAQ?

  • I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • I am sure my question is not about a technical issue.

Question

How do I connect to the SSH?, and how can I connect via VNC too?

services:
  qemu:
    image: qemux/qemu-docker
    environment:
      DISPLAY: "vnc"
      RAM_SIZE: "512M"
      DISK_SIZE: "1G"
      BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/alpine-virt-3.9.6-x86_64.iso"
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 2204:22
      - 5900:5900
    stop_grace_period: 2m

if I remember that Vnc is on 5900 right?, I've read some of the issues created by other too #573 (comment)

but when I access it it showed nothing on the web
image

also how do I connect into the ssh?, since I got this
image

Question: Could this run on an ubuntu-base?

Hi - I just wanted to know if it would be possible to run this dockerfile, but using ubuntu 20.04 or 22.04 as base and not debian-trixie?
Background: I wanna try to merge this container with another one, since I am not a fan of noVNC... :)

Thanks

I can ping from inside the container to the native host but not the reverse

More of a question than an issue:

Inside the container I see:

`[root@ab1fb803e1ee /]# ifconfig
dockerbridge: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 20.20.20.1 netmask 255.255.255.0 broadcast 20.20.20.255
ether d2:91:33:59:fc:dc txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1 bytes 54 (54.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.2 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:ac:11:00:02 txqueuelen 0 (Ethernet)
RX packets 12 bytes 1016 (1016.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

qemu: flags=4355<UP,BROADCAST,PROMISC,MULTICAST> mtu 1500
ether d2:91:33:59:fc:dc txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0`

If I try to ping my native host I can do that.

If I try to ping from native host the 20.20.20.1 obviously it doesn't work, I imagine I need to do some settings on the native host

Windows VM: New Network Profiles Generated on Reboot

Operating system

Debian 12

Description

I've set up a QEMU virtual machine running Windows. The virtual machine has been successfully installed, and I've manually installed Virtio drivers for networking. However, whenever I initiate a reboot or restart of the virtual machine / Docker container, a new network profile is created (e.g., "Network 2", "Network 3", etc.).

Attempts:
I've tried setting the environment variable "MAC=[generic MAC address]" to ensure consistent network interface identification across reboots, but this hasn't resolved the issue.

Expected Behavior:
Ideally, the network profile should remain consistent across reboots.

Docker compose

  qemu:
    image: qemux/qemu-docker
    container_name: qemu
    cap_add:
      - NET_ADMIN
    environment:
      - BOOT_MODE=windows
      - DISK_SIZE=256G
      - CPU_CORES=4
      - RAM_SIZE=8G
      - ARGUMENTS=-rtc base=localtime
    volumes:
      - ./QEMU:/storage
    ports:
      - 8006:8006
      - 3389:3389
    devices:
      - /dev/kvm
    stop_grace_period: 2m
    restart: on-failure

Docker log

BdsDxe: loading Boot0004 "Windows Boot Manager" from HD(1,GPT,7A2A63BB-FF5D-4F22-9A44-F6722016A7EA,0x800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi
BdsDxe: starting Boot0004 "Windows Boot Manager" from HD(1,GPT,7A2A63BB-FF5D-4F22-9A44-F6722016A7EA,0x800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi

Screenshots (optional)

image

[Question]: How to create a disk snapshot?

Is your question not already answered in the FAQ?

  • I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • I am sure my question is not about a technical issue.

Question

Is there any way to create a snapshot for my virtual machine so that I can roll back the virtual machine when necessary?

Option to boot without BOOT env var after install to disk?

Is there an option to start the container with an empty cdrom drive after install to disk? Doing so is fairly standard practice in my experience, if i am following along properly this currently requires BOOT based on the this from install.sh but would be nice if BOOT could be optional much like a physical optical drive.

if [ -z "$BOOT" ]; then

Happy to be pointed in the right direction however if this is already possible, thanks

How to run TempleOS in qemu-docker?

Description

I set the BOOT variable to use https://templeos.org/Downloads/TempleOS.ISO, but TempleOS does not start.

I have what we can see in the screenshot below:

templeos

When running normal qemu-system-x86_64, it works.

Using the normal qemu I first create the disk:

qemu-img create -f qcow2 temple 2G

qemu-system-x86_64 -soundhw pcspk -m 512M -enable-kvm -drive file=temple -cdrom TempleOS.ISO -boot order=d

Then I run it:

qemu-system-x86_64 -soundhw  pcspk -m 2G -smp 14 -enable-kvm -drive file=temple

But I wasn't yet able to make it work with qemu-docker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.