How to run qemu inside docker with networkmode bridged

784 Views Asked by At

I have a qemu-aarch64 commandline that uses a network in bridged mode like this.

qemu-system-aarch64 -nographic -machine virt -m 1G -smp 4 \
    -cpu cortex-a53 \
    -kernel ${illumos_dir}/usr/src/psm/stand/boot/aarch64/virt/inetboot.bin \
    -append "-D /virtio_mmio@a003e00" \
    -netdev bridge,id=net0,br=${IFACE} \
    -device virtio-net-device,netdev=net0,mac=52:54:00:70:0a:e4 \
    -device virtio-blk-device,drive=hd0 \
    -drive file=${disk_img},format=raw,id=hd0,if=none \
    -semihosting-config enable=on,target=native \
    -gdb tcp::1234

Inside of the container I can not use -netdev bridge,id=net0,br=${IFACE} because of failed to add interface 'tap0' to bridge 'eth0': Operation not supported so I am looking for a -netdev commandline that works inside a container but that allows -append "-D /virtio_mmio@a003e00" to still work. Best would be if somebody can tell me how to get this commandline working with this -netdev arg.

I start the container with docker-compose

  qemu_aarch64:
    build: "./qemu-installer"
    networks:
      - "illumosaarchdev"
    volumes:
      - "./:/data:rw"
    cap_add:
      - ALL
    depends_on:
      - nfs_root
      - tftp
      - dhcp
    devices:
      - "/dev/net/tun:/dev/net/tun"
0

There are 0 best solutions below