AH00112:警告:DocumentRoot [ ] 不存在

AH00112: Warning: DocumentRoot [ ] does not exist

我正在使用 docker 到 运行 一个使用 laravel 构建的应用程序,一切正常,直到出于某种原因我重置为出厂默认设置然后构建图像再次 运行 容器,但现在我收到此警告

AH00112: Warning: DocumentRoot [/var/www/html/kh/public] does not exist

虽然这个根目录确实存在并且在我将 docker 重置为出厂默认设置之前它工作正常。

这是docker-compose.yml文件

services:
  kh:
    build:
      context: ./
      dockerfile: Dockerfile
      args:
        uid: ${UID}
    container_name: kh
    environment:
      - APACHE_RUN_USER=#${UID}
      - APACHE_RUN_GROUP=#${UID}
    depends_on:
      - khdb
    ports:
      - 3000:80
      - 8443:443
    volumes:
      - ./:/var/www/html/kh
    networks:
      backend:
        aliases:
          - kh

vhost.config 文件

SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
SSLHonorCipherOrder on
#SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384::ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:RSA-WITH-AES-256-GCM-SHA384:DHE-RSA-WITH-AES-256-GCM-SHA384

<VirtualHost *:80>
    ServerName schooling.test
    ServerAlias www.schooling.test
    ServerAdmin info@schooling.test
    DocumentRoot ${APACHE_DOCUMENT_ROOT}

    <Directory ${APACHE_DOCUMENT_ROOT}>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    </Directory>

    ErrorLog /var/log/apache2/schooling-error.log
    CustomLog /var/log/apache2/schooling-access.log combined
</VirtualHost>

<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/key.pem
    SSLCertificateKeyFile /etc/apache2/ssl/ssl.key

    SSLCACertificateFile /etc/apache2/ssl/key.pem
    SSLUseStapling On

    SSLProtocol TLSv1.2
    SSLProxyProtocol TLSv1.2


    ServerName schooling.test
    ServerAlias www.schooling.test
    ServerAdmin info@schooling.test
    DocumentRoot ${APACHE_DOCUMENT_ROOT}
    <Directory ${APACHE_DOCUMENT_ROOT}>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    </Directory>
    ErrorLog /var/log/apache2/schooling-error.log
    CustomLog /var/log/apache2/schooling-access.log combined
</VirtualHost>

问题已解决 运行:

docker image prune -a


docker-compose up -d --build