Docker错误:无法为服务Web创建容器:无效模式

问题描述 投票:2回答:1

我运行docker时遇到三个错误:

错误:for learningphp7_web_1无法为服务Web创建容器:无效模式:/etc/apache2/sites-enabled/virtualhosts.conf

错误:for web无法为服务Web创建容器:无效模式:/etc/apache2/sites-enabled/virtualhosts.conf

错误:启动项目时遇到错误。

我怎样才能解决这些问题并最终开始使用docker?

我的virtualhosts.conf

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /var/www/html/web
  DirectoryIndex index.php

  <Directory /var/www/html/web>
    AllowOverride None
    Require all granted
    Allow from All
    Options FollowSymLinks
    <IfModule mod_rewrite.c>
          Options -MultiViews
          RewriteEngine On
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^(.*)$ index.php [QSA,L]
    </IfModule>
  </Directory>
</VirtualHost>
apache docker docker-compose docker-machine
1个回答
6
投票

检查您的docker-compose.yml文件。由于卷配置中有额外的空间,我最近遇到了同样的错误:

  volumes:
  - ./www:/home/distressedpro/public_html
   - ./conf:/etc/apache2/sites-available

注意最后一行的额外空间,这是造成错误的原因。更正为:

  volumes:
  - ./www:/home/distressedpro/public_html
  - ./conf:/etc/apache2/sites-available

固定它

© www.soinside.com 2019 - 2024. All rights reserved.