【问题标题】:Docker container CentOs with ApacheDocker 容器 CentOs 与 Apache
【发布时间】:2017-12-14 09:31:15
【问题描述】:

我正在玩弄 Docker。但是当我尝试在容器中构建 Centos 和 Apache 服务器时,我遇到了 Docker 的问题。我在我的 Windows 10 机器上运行 Docker。 CentOS + Apache 容器与 Maria DB 映像相结合。

当我执行 docker-compose 时,我的 Apache 容器启动并立即关闭,退出代码为 0。

这是我的 dockerfile:

FROM centos:centos7
LABEL Author = "Aurelien H."
LABEL Description = "DOCKERFILE : Allows the creation of a Container with a Centreon distribution installed via packages"

#Update and install requirements
RUN yum update -y
RUN yum install -y wget nano centos-release-scl httpd git

#Install Centreon repo
RUN cd /usr/local/src
RUN wget http://yum.centreon.com/standard/3.4/el7/stable/noarch/RPMS/centreon-release-3.4-4.el7.centos.noarch.rpm
RUN yum install -y --nogpgcheck centreon-release-3.4-4.el7.centos.noarch.rpm

#Install Centreon
RUN yum install -y centreon-base-config-centreon-engine centreon centreon-pp-manager
RUN yum clean all
#RUN systemctl enable httpd.service
#RUN systemctl start httpd.service
EXPOSE  80
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]

这是我的 docker compose。

centreon:
  build: ./centreon
  ports:
    - "80:80"
#  volumes:
#    - "./data"
  links:
   - mariadb
mariadb:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: notR00tPassword

【问题讨论】:

  • 试试CMD ["/usr/sbin/httpd","-DFOREGROUND"]
  • 它似乎不起作用。仍然有这个消息:trainingdocker_centreon "/bin/bash" 22 seconds ago Exited (0) 22 seconds ago
  • 我遇到的问题不是来自 docker 文件,而是来自 Docker compose。
  • 我通过在执行 docker compose 时强制重建我的图像来解决。我对 Docker 的缓存有疑问。问题解决了。

标签: apache docker centos7


【解决方案1】:

我需要使用“docker-compose up --build”命令。 它在执行图像之前重建图像。 问题解决了。

【讨论】:

    猜你喜欢
    • 2018-06-21
    • 2018-08-10
    • 2016-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-22
    相关资源
    最近更新 更多