BBVA / kvm

Simple Docker KVM container
Apache License 2.0
207 stars 50 forks source link

Move image to alpine? #2

Open pwFoo opened 8 years ago

pwFoo commented 8 years ago

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
methadata commented 8 years ago

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 8 years ago

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 8 years ago
kvm                                           latest              b7b1e0370df3        19 minutes ago      42.31 MB
bbvainnotech/kvm                              latest              3076a53caa13        2 hours ago         319.2 MB
methadata commented 8 years ago

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: