Docker CentOS systemctl

1

Eu estou tentando construir uma imagem do CentOS com o comando systemctl. Mas cada vez quando eu construí-lo . Eu obtenho este erro:

Step 6/10 : RUN systemctl enable syslog-ng && systemctl start syslog-ng
 ---> Running in 9a8c5a2cdbae
Failed to get D-Bus connection: Operation not permitted
The command '/bin/sh -c systemctl enable syslog-ng && systemctl start syslog-ng' returned a non-zero code: 1

Meu Dockerfile:

FROM centos:7
ENV container docker
RUN yum -y update
RUN yum -y install epel-release && \
    yum -y install vim && \
    yum -y install wget && \
    yum -y install rsync && \
    yum -y groupinstall "Development tools"
# Install syslog-ng 3.14
RUN cd /etc/yum.repos.d/ && \
    wget https://copr.fedorainfracloud.org/coprs/czanik/syslog-ng314/repo/epel-7/czanik-syslog-ng314-epel-7.repo && \
    yum -y install syslog-ng
RUN systemctl enable syslog-ng && systemctl start syslog-ng
RUN yum -y remove rsyslog
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" ]
CMD ["/usr/sbin/init"]

Alguém sabe o que eu faço de errado?

Obrigado,

    
por DevHugo 10.10.2018 / 10:09

1 resposta

0

Remova todos os comandos systemctl e execute syslog como CMD para iniciá-lo.

CMD ["syslog-ng"]
    
por 10.10.2018 / 14:22