|
| 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