【发布时间】:2016-10-09 22:55:53
【问题描述】:
我目前正在运行 Openshift,但是当我尝试构建/部署我的自定义 Docker 容器时遇到了问题。该容器在我的本地机器上正常工作,但是一旦它在 openshift 中构建并且我尝试部署它,我就会收到错误消息。我相信问题是因为我试图以 root 身份在容器内运行命令。
(13)Permission denied: AH00058: Error retrieving pid file /run/httpd/httpd.pid
我正在部署的 Docker 文件如下所示 -
FROM centos:7
MAINTAINER me<me@me>
RUN yum update -y
RUN yum install -y git https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install -y ansible && yum clean all -y
RUN git clone https://github.com/dockerFileBootstrap.git
RUN ansible-playbook "-e edit_url=andrewgarfield edit_alias=emmastone site_url=testing.com" dockerAnsible/dockerFileBootstrap.yml
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/*;
COPY supervisord.conf /usr/etc/supervisord.conf
RUN rm -rf supervisord.conf
VOLUME [ "/sys/fs/cgroup" ]
EXPOSE 80 443
#CMD ["/usr/bin/supervisord"]
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
我多次遇到类似的问题,它会说Permission Denied on file /supervisord.log 或类似的东西。
如何设置它,使我的容器不会以 root 身份运行所有命令?它似乎导致了我遇到的所有问题。
【问题讨论】: