【问题标题】:docker container with apache server gets killed [duplicate]带有apache服务器的docker容器被杀死[重复]
【发布时间】:2018-05-04 15:11:12
【问题描述】:

我是 Containers 的新手,并尝试使用教程来了解它:

http://containertutorials.com/alpine/alpine-apache-server-static-site.html

在这里,我创建了 dockerfile 并尝试运行容器,但每次都失败。有什么指点吗?

root@ubuntu:/home/skorada# docker run -it -p 4000:80 --name my-apache2- alpine-1  my-apache2-alpine
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 30-resolver: executing... 
[cont-init.d] 30-resolver: exited 0.
[cont-init.d] 40-resolver: executing... 
[cont-init.d] 40-resolver: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
AH00558: httpd: Could not reliably determine the server's fully qualified  domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] syncing disks.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

这是我的 dockerfile

FROM smebberson/alpine-apache
ADD ./public-html/myindex.html /var/www/localhost/htdocs
RUN echo 'ServerName localhost' >> /etc/apache2/apache2.conf

为什么 docker 容器没有启动并运行?想不通。 浏览了不同的链接,但到目前为止没有任何帮助。

【问题讨论】:

    标签: docker containers alpine


    【解决方案1】:

    这是该 docker 映像的一个已知问题。请参阅 this issuethis。它已经有将近一年的时间没有得到修复,所以我的建议是在 Apache 中使用另一个 Docker 映像。

    你可以试试official repo。只需将cd 放入包含您的文件的目录,然后

    docker run -dit --name my-apache-app -p 8080:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4
    

    转到localhost:8080 就可以了。

    【讨论】:

    • 谢谢安德里亚。您的建议有所帮助。
    猜你喜欢
    • 1970-01-01
    • 2019-06-03
    • 2017-09-25
    • 2010-09-08
    • 2018-12-03
    • 1970-01-01
    • 2016-07-31
    • 1970-01-01
    相关资源
    最近更新 更多