为什么Apache不能在端口80上工作?

大家都知道Docker运行的主机不需要知道Docker容器里面的东西。 正因为如此,我正试图添加对容器内运行cronjobs支持。 阅读了一些关于如何实现这个像下面列出的职位的post:

  • https://www.ekito.fr/people/run-a-cron-job-with-docker/
  • 如何在Docker容器中运行cron作业?
  • http://www.anotherchris.net/posts/running-cron-jobs-inside-a-docker-container

我正在尝试使用以下图像来实现我的“自定义”解决scheme。

这就是我所做的:

  • 增加了一个文件api_command-cron到目录/config/etc/cron.d
  • 将文件api_command.sh添加到目录/usr/local/bin

另外,我在entrypoint.sh文件中添加了以下更改:

 ################################################################## # Setup CronJobs ################################################################## ln -sfn /var/www/html/oneview_symfony/bin/console /bin/sfconsole # Disable this cronjob if the ENV variable is false if [ "${ENABLE_API_CRON}" == "false" ] then # Disable the cronjob sed -i '/0/s/^/#/g' /etc/cron.d/api_command-cron fi echo "API Cron Status: ${ENABLE_API_CRON}" 

因为我使用的是Docker Compose(docker-compose.yml)堆栈,所以我build立了这个容器:

 $ docker-compose up --force-recreate --build --remove-orphans 

构build过程进展良好,容器启动没有任何问题。

 Successfully built 64ee76d6fbe4 Successfully tagged dockerlamp_webserver:latest Creating dockerlamp_webserver_1 ... Creating dockerlamp_webserver_1 ... done Attaching to dockerlamp_webserver_1 webserver_1 | UID: 1000 webserver_1 | GID: 1000 webserver_1 | API Cron Status: true webserver_1 | Enabling module rewrite. webserver_1 | Enabling module expires. webserver_1 | To activate the new configuration, you need to run: webserver_1 | service apache2 restart webserver_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message 

只要我尝试通过http://localhost访问应用程序,我得到一个空白页面,根本没有日志。 这个问题不是应用程序,因为相同的源代码在没有这个新变化的master分支的图像上工作。

为什么应用程序在这种情况下停止工作?