QEMU for ARM in a Docker container.
Find a file
2023-04-15 18:10:28 +02:00
.github Update test.yml 2023-04-14 01:58:54 +02:00
build.sh Update build.sh 2023-04-12 02:24:05 +02:00
disk.sh Add disk resizes 2023-04-15 18:00:43 +02:00
docker-compose.yml Update docker-compose.yml 2023-04-15 18:10:28 +02:00
Dockerfile Update Dockerfile 2023-04-14 17:50:36 +02:00
install.sh Error handling 2023-04-15 18:09:20 +02:00
network.sh Simplify 2023-04-15 12:54:20 +02:00
power.sh Linebreaks 2023-04-15 00:42:47 +02:00
readme.md Update readme.md 2023-04-15 18:07:54 +02:00
run.sh Comments 2023-04-14 18:16:15 +02:00

docker-qemu

build_img gh_last_release_svg Docker Image Size Docker Pulls Count

QEMU in a docker container using KVM acceleration.

Features

  • KVM acceleration
  • Graceful shutdown

Usage

Via docker-compose.yml

version: "3"
services:
    qemu:
        container_name: qemu
        image: kroese/docker-qemu:latest
        environment:
            DISK_SIZE: "16G"
            BOOT: "http://www.example.com/image.iso"
        devices:
            - /dev/kvm
        cap_add:
            - NET_ADMIN                       
        ports:
            - 22:22
        volumes:
            - /var/qemu:/storage
        restart: on-failure

Via docker run

$ docker run -it --rm -e "BOOT=http://www.example.com/image.iso" --device=/dev/kvm --cap-add NET_ADMIN kroese/docker-qemu:latest

FAQ

  • How do I change the bootdisk?

    You can modify the BOOT setting to specify the URL of any ISO image:

    environment:
      BOOT: "http://www.tinycorelinux.net/13.x/x86/release/Core-13.1.iso"
    

    It will be downloaded only once, during the first run of the container.

  • How do I change the size of the data disk?

    By default it is 16GB, but you can modify the DISK_SIZE setting in your compose file:

    environment:
      DISK_SIZE: "16G"
    

    To resize the disk to a capacity of 8 terabyte you would use a value of "8T" for example.

  • How do I change the location of the data disk?

    By default it resides inside a docker volume, but you can add these lines to your compose file:

    volumes:
      - /home/user/data:/storage
    

    Just replace /home/user/data with the path to the folder you want to use for storage.

  • How do I change the amount of CPU/RAM?

    By default an amount of 512MB RAM and 1 vCPU is allocated to the container.

    To increase this you can add the following environment variabeles:

    environment:
      CPU_CORES: "4"
      RAM_SIZE: "2048M"
    
  • How do I give the container a dedicated IP address?

    By default the container uses bridge networking, and is reachable by the IP of the docker host.

    If you want to give it a seperate IP address, create a macvlan network that matches your local subnet:

    $ 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
    

    And change the network of the container to vlan in your run command:

     --network vlan --ip=192.168.0.100
    

    This has the advantage that you don't need to do any portmapping anymore.