Docker Community Forums

Share and learn in the Docker community.

Can we install kvm in docker?

can we install the kvm in docker if yes it is specific to any specific version

Here’s a dockerfile that will enable just that.

# Run libvirt deamon in a container
#
# docker run -d \
# --privileged \
# -v /var/run/libvirt:/var/run/libvirt \
# --name kvm \
# jess/kvm
#
FROM debian:sid
LABEL maintainer “Jessie Frazelle jess@linux.com
RUN apt-get update && apt-get install -y \
iptables \
libgl1-mesa-dri \
libgl1-mesa-glx \
libvirt-daemon-system \
python-gi \
python-ipaddr \
qemu-kvm \
virtinst \
virt-viewer \
–no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
COPY ./start.sh /start.sh
ENTRYPOINT ["/start.sh"]
CMD [“libvirtd”]

(original source: https://stackoverflow.com/questions/48422001/how-to-launch-qemu-kvm-from-inside-a-docker-container)