Docker CentOS 시스템 제어

Docker CentOS 시스템 제어

systemctl 명령을 사용하여 CentOS 이미지를 빌드하려고 합니다. 하지만 매번내가 그것을 만들 때. 다음 오류가 발생합니다.

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

내 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"]

내가 뭘 잘못하고 있는지 아는 사람 있나요?

감사해요,

답변1

모든 systemctl명령을 제거하고 syslogCMD로 실행하여 시작하십시오.

CMD ["syslog-ng"]

관련 정보