BBVA/kvm

Move image to alpine?

pwFoo opened this issue · 4 comments

pwFoo commented

Could be easy to do and reduce the image size?

Tested qemu kvm with a simple alpine container

docker run --rm -ti --name kvm --cap-add NET_ADMIN -v /path-to-my-qcow2.img:/image/image.qcow2 --device /dev/kvm:/dev/kvm alpine sh
apk -U add qemu-system-x86_64 qemu bridge-utils dnsmasq

qemu-system-x86_64 -enable-kvm -cpu host -m 1024 -curses -drive file=/image/image.qcow2,format=qcow2,cache=none -usb -usbdevice tablet

Thank you for your feedback, pwFoo!

I have this in the roadmap, and I will move the image to a minimal container ASAP.

pwFoo commented

Great! :)

Tested it with the followin modifications.

dockerfile

FROM    alpine:latest

ENV     container docker

RUN     apk -U --no-cache add qemu qemu-system-x86_64 bridge-utils bash dnsmasq && rm -rf /var/cache/apk/*

COPY    startvm /usr/local/bin/startvm

RUN     chmod u+x /usr/local/bin/startvm \
        && mkdir /etc/dnsmasq.d

VOLUME  /image

ENTRYPOINT ["/usr/local/bin/startvm"]
CMD []

startvm

+   -machine accel=kvm,usb=off \
-    -machine rhel6.0.0,accel=kvm,usb=off \
pwFoo commented
kvm                                           latest              b7b1e0370df3        19 minutes ago      42.31 MB
bbvainnotech/kvm                              latest              3076a53caa13        2 hours ago         319.2 MB

Reopened due to networking issues with Alpine container.

Master branch will still be built with Centos until everything is solved. After that, Alpine branch will be merged.

Some debug info for future investigation:

  • Centos container: QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-105.el7_2.7)
  • Alpine container: QEMU emulator version 2.5.1