I am trying to build my first docker container to do smokeping or cacti.
For some reason i’m getting an error on DBus when building the container.
My OS version is CentOS 7 latest.
I’m using CentOS 7 for the container build.
rpm -qa|grep -i docker
docker-common-1.13.1-68.gitdded712.el7.centos.x86_64
docker-devel-1.3.2-4.el7.centos.x86_64
docker-latest-v1.10-migrator-1.13.1-58.git87f2fab.el7.centos.x86_64
docker-novolume-plugin-1.13.1-68.gitdded712.el7.centos.x86_64
docker-latest-1.13.1-58.git87f2fab.el7.centos.x86_64
docker-lvm-plugin-1.13.1-68.gitdded712.el7.centos.x86_64
docker-v1.10-migrator-1.13.1-68.gitdded712.el7.centos.x86_64
python2-dockerpty-0.4.1-9.el7.noarch
docker-distribution-2.6.2-2.git48294d9.el7.x86_64
docker-client-1.13.1-68.gitdded712.el7.centos.x86_64
docker-unit-test-1.13.1-68.gitdded712.el7.centos.x86_64
docker-1.13.1-68.gitdded712.el7.centos.x86_64
docker-latest-logrotate-1.13.1-58.git87f2fab.el7.centos.x86_64
docker-forward-journald-1.10.3-44.el7.centos.x86_64
python-docker-pycreds-1.10.6-4.el7.noarch
python-docker-py-1.10.6-4.el7.noarch
docker-client-latest-1.13.1-58.git87f2fab.el7.centos.x86_64
docker-logrotate-1.13.1-68.gitdded712.el7.centos.x86_64
docker-compose-1.9.0-5.el7.noarch
Here is the command I use to run the build
sudo docker build . --rm -t smokeping:1.1
Here is my Dockerfile
FROM centos:centos7
MAINTAINER me: version 1.0
ENV container docker
RUN yum update -y; yum clean all
#RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs dbus*
#RUN systemctl mask dev-mqueue.mount dev-hugepages.mount systemd-remount-fs.service sys-kernel-config.mount sys-kernel-debug.mount sys-fs-fuse-connections.mount
#RUN systemctl mask display-manager.service systemd-logind.service
#RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
# systemd-tmpfiles-setup.service ] || rm -f $i; done); \
# rm -f /lib/systemd/system/multi-user.target.wants/*;\
# rm -f /etc/systemd/system/*.wants/*;\
# rm -f /lib/systemd/system/local-fs.target.wants/*; \
# rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
# rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
# rm -f /lib/systemd/system/basic.target.wants/*;\
# rm -f /lib/systemd/system/anaconda.target.wants/*;
#VOLUME [ "/sys/fs/cgroup" ]
#RUN systemctl disable graphical.target
#RUN systemctl enable multi-user.target
#VOLUME ["/run"]
#CMD ["/usr/lib/systemd/systemd"]
RUN yum install epel-release -y && yum install smokeping echoping fping.x86_64 httping dhcping hping3 ioping tcping httpd mod_ssl openssh-server passwd -y
EXPOSE 80
RUN systemctl enable httpd
RUN systemctl enable smokeping
#RUN systemctl enable dbus
#RUN systemctl start dbus
RUN systemctl start httpd
RUN systemctl start smokeping
CMD ["/usr/sbin/init"]
Here is the output at the end of the build
Failed to get D-Bus connection: Operation not permitted
The command '/bin/sh -c systemctl start httpd' returned a non-zero code: 1
What am I doing wrong?