Answer the question
In order to leave comments, you need to log in
[[+content_image]]
How to bypass "service httpd restart" run restrictions inside Centos7 container?
I tried everything that is on the Internet on this topic, I can not get around the restrictions on running the service inside the container.
[[email protected] bitrix]# systemctl --version
systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN
[[email protected] bitrix]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Failed to get D-Bus connection: Operation not permitted
FROM centos:latest
RUN yum -y upgrade
RUN yum -y install initscripts boost-devel && yum clean all
#RUN yum -y install lsb boost-devel
ADD http://repos.1c-bitrix.ru/yum/bitrix-env.sh /tmp/
RUN sed -i s/'print_e "Cannot configure firewall on the server. PLease see $LOGS_FILE"'/'echo "Cannot configure firewall on the server. PLease see $LOGS_FILE"'/gi /tmp/bitrix-env.sh
RUN sed -i 's/read version_c/version_c=5/gi' /tmp/bitrix-env.sh
RUN chmod +x /tmp/bitrix-env.sh
RUN /tmp/bitrix-env.sh <<< "n"
docker build -t bitrix1/eod-docker .
docker rm -f eod-docker
docker run --privileged=true \
--cap-add=SYS_ADMIN \
-e "container=docker" \
-d \
--security-opt seccomp=unconfined \
--tmpfs /run --tmpfs /run/lock \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
--name eod-docker -v /root/mydocker/eod-docker/bitrix:/home/bitrix \
-ti -p 803:80 bitrix1/eod-docker \
bash -c "/usr/sbin/init"
Answer the question
In order to leave comments, you need to log in
No way.
Systemd should never be a supervisor in a container.
And you don’t need to reinvent the wheel, but find a suitable container with Apache.
#Run
a container
docker run -it -e "container=docker" --privileged=true -d --security-opt seccomp:unconfined --cap-add=SYS_ADMIN -v /sys/fs/cgroup:/sys/ fs/cgroup:ro local_redis bash -c "/usr/sbin/init"
#Exec bash to get shell
docker exec -it [ContainerID] /bin/bash --
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question