Skip to content

Commit 1ecc6f9

Browse files
committed
Merge pull request #50 from baude/master
Initial versions of libvirtd/libvirtclient in containers
2 parents bdd8f33 + fa933cf commit 1ecc6f9

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM rhel7
2+
MAINTAINER "Brent Baude" <[email protected]>
3+
ENV container docker
4+
RUN yum -y update && yum clean all
5+
RUN rpm -e --nodeps fakesystemd & yum -y install systemd
6+
RUN yum -y install virt-viewer virt-install libvirt-client && yum clean all; \
7+
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
8+
rm -f /lib/systemd/system/multi-user.target.wants/*;\
9+
rm -f /etc/systemd/system/*.wants/*;\
10+
rm -f /lib/systemd/system/local-fs.target.wants/*; \
11+
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
12+
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
13+
rm -f /lib/systemd/system/basic.target.wants/*;\
14+
rm -f /lib/systemd/system/anaconda.target.wants/*
15+
16+
VOLUME [ "/var/lib/libvirt/" ]
17+
CMD ["/usr/sbin/init"]
18+
19+
RUN echo 'uri_default = "qemu+tcp://172.17.42.1/system"' >> /etc/libvirt/libvirt.conf

rhel-libvirt/libvirtd/Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM rhel7
2+
MAINTAINER "Brent Baude" <[email protected]>
3+
ENV container docker
4+
RUN yum -y update && yum clean all
5+
RUN rpm -e --nodeps fakesystemd
6+
RUN yum -y install systemd
7+
#RUN yum -y install libvirt-daemon-driver-{network,interface,storage,qemu} qemu systemd libvirt-daemon && yum clean all; \
8+
RUN yum -y install libvirt-daemon-driver-* libvirt-daemon libvirt-daemon-kvm qemu-kvm && yum clean all; \
9+
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
10+
rm -f /lib/systemd/system/multi-user.target.wants/*;\
11+
rm -f /etc/systemd/system/*.wants/*;\
12+
rm -f /lib/systemd/system/local-fs.target.wants/*; \
13+
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
14+
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
15+
rm -f /lib/systemd/system/basic.target.wants/*;\
16+
rm -f /lib/systemd/system/anaconda.target.wants/*; \
17+
systemctl enable libvirtd; \
18+
systemctl enable virtlockd
19+
20+
EXPOSE 16509
21+
22+
RUN echo "listen_tls = 0" >> /etc/libvirt/libvirtd.conf; \
23+
echo 'listen_tcp = 1' >> /etc/libvirt/libvirtd.conf; \
24+
echo 'tls_port = "16514"' >> /etc/libvirt/libvirtd.conf; \
25+
echo 'tcp_port = "16509"' >> /etc/libvirt/libvirtd.conf; \
26+
echo 'auth_tcp = "none"' >> /etc/libvirt/libvirtd.conf
27+
28+
RUN echo 'LIBVIRTD_ARGS="--listen"' >> /etc/sysconfig/libvirtd
29+
RUN mkdir -p /var/lib/libvirt/images/
30+
31+
# Edit the service file which includes ExecStartPost to chmod /dev/kvm
32+
RUN sed -i "/Service/a ExecStartPost=\/bin\/chmod 666 /dev/kvm" /usr/lib/systemd/system/libvirtd.service
33+
34+
VOLUME [ "/sys/fs/cgroup" ]
35+
CMD ["/usr/sbin/init"]

0 commit comments

Comments
 (0)