mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2025-01-30 17:13:46 +01:00
add kvm and virsh
Signed-off-by: Jess Frazelle <jess@mesosphere.com>
This commit is contained in:
parent
1faa831e49
commit
ffe22c67bc
28
kvm/Dockerfile
Normal file
28
kvm/Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Run libvirt deamon in a container
|
||||
#
|
||||
# docker run -d \
|
||||
# --privileged \
|
||||
# -v /var/run/libvirt:/var/run/libvirt \
|
||||
# --name kvm \
|
||||
# jess/kvm
|
||||
#
|
||||
FROM debian:sid
|
||||
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"]
|
19
kvm/start.sh
Executable file
19
kvm/start.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# add the correct user perms
|
||||
gpasswd -a root libvirt
|
||||
gpasswd -a root kvm
|
||||
chown root:kvm /dev/kvm
|
||||
|
||||
# create the bridge for networking
|
||||
ip link add name virt0 type bridge
|
||||
ip link set virt0 up
|
||||
bridge link
|
||||
ip addr add dev virt0 192.168.66.66/24
|
||||
iptables -t nat -A POSTROUTING -s 192.168.66.66/24 -j MASQUERADE
|
||||
|
||||
# start the virtlogd daemon
|
||||
exec virtlogd --daemon &
|
||||
|
||||
exec $@
|
8
libvirt-client/Dockerfile
Normal file
8
libvirt-client/Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
FROM alpine:latest
|
||||
MAINTAINER Jessica Frazelle <jess@docker.com>
|
||||
|
||||
RUN apk update && apk add \
|
||||
libvirt-client \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
CMD [ "virsh" ]
|
Loading…
Reference in New Issue
Block a user