Contêiner do Docker com Centos 7 e systemd

1

Estou tentando executar o contêiner centos + systemd Docker conforme descrito aqui link .

  1. docker build --rm -t local/c7-systemd c7-systemd

Dockerfile:

    FROM centos:7
    ENV container docker
    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. docker build --rm -t local/c7-systemd-httpd c7-systemd-httpd

Dockerfile:

    FROM local/c7-systemd
    RUN echo "myproxy" >> /etc/yum.conf
    RUN yum -y install httpd; yum clean all; systemctl enable httpd.service
    EXPOSE 80
    CMD ["/usr/sbin/init"]
  1. docker run -ti --cap-add SYS_ADMIN --security-opt seccomp:unconfined -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 local/c7-systemd /bin/bash

Eu também tentei com --privileged , mas toda vez que recebo isso:

    [root@e29ecfb082d8 /]# systemctl status
    Failed to get D-Bus connection: Operation not permitted

Eu estou rodando no Cygwin, Docker versão 18.03.1-ce, build 9ee9f40 (Docker para Windows).

Poderia, por favor, dizer se existem maneiras de obter um contêiner centos7 + systemd funcional com essa configuração?

    
por T. Kryazh 27.06.2018 / 16:56

1 resposta

2

Eu tenho um contêiner de trabalho com link

  1. docker build --rm --no-cache -t c7-systemd-off c7-systemd-off

Dockerfile:

    FROM centos/systemd

    RUN echo "myproxy" >> /etc/yum.conf
    RUN yum -y install httpd; yum clean all; systemctl enable httpd.service

    EXPOSE 80

    CMD ["/usr/sbin/init"]
  1. docker run --privileged --name c7 -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 -d c7-systemd-off

  2. docker exec -it c7 /bin/bash

por 27.06.2018 / 17:37