Apache退出,代码为0 docker apache try

时间:2018-10-05 15:49:51

标签: php apache docker fedora lamp

当前在使用Docker时成功运行apache网络服务器时遇到问题...

这是我的docker文件:

FROM fedora:27

# Container Owner
MAINTAINER nzhiti@gmail.com

# Update & install Apache & clean dnf
RUN dnf upgrade -y 
RUN dnf install -y httpd
RUN dnf clean packages
RUN dnf install -y mod_ssl

# Configuring hosts
ADD ./hosts/hosts /etc/hosts


# Port 
EXPOSE 443

# Starting httpd
ENTRYPOINT ["/usr/sbin/httpd"] & CMD ["-D", "FOREGROUND"]

在构建过程中没有错误。但是,当我尝试编写它时,它永远不会起作用,并且输出的唯一消息是apache exiting with code 0

version: '3'
services:
    php-apache:
        image : httpd_fedora
        ports:
            - 443:443
        volumes:
            - ./Apache/www/:/var/www/html
            - ./Apache/vhosts/:/etc/httpd/conf.d/
            - ./Apache/SSLcert/:/etc/httpd/ssl/
            - ./Apache/errorlogs/error.log:/var/log/httpd/error.log
    tty: true

我没主意了...

谢谢, DRK

1 个答案:

答案 0 :(得分:0)

尝试缩进tty: true,使其与php_apache属性对齐。还将Dockerfile复制到docker-compose.yml的相同目录,并将image更改为build: .

version: '3'
services:
    php-apache:
        build: .
        ports:
            - 443:443
        volumes:
            - ./Apache/www/:/var/www/html
            - ./Apache/vhosts/:/etc/httpd/conf.d/
            - ./Apache/SSLcert/:/etc/httpd/ssl/
            - ./Apache/errorlogs/error.log:/var/log/httpd/error.log
        tty: true