Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker error: Cannot create container for service web: invalid mode

I'm having three errors when i run docker:

ERROR: for learningphp7_web_1 Cannot create container for service web: invalid mode: /etc/apache2/sites-enabled/virtualhosts.conf

ERROR: for web Cannot create container for service web: invalid mode: /etc/apache2/sites-enabled/virtualhosts.conf

ERROR: Encountered errors while bringing up the project.

How can i solve these issues and finally start using docker?

My 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>
like image 975
Ulugbek Mamatkulov Avatar asked Jan 24 '18 15:01

Ulugbek Mamatkulov


1 Answers

Check your docker-compose.yml file. I recently had the same error, due to an extra space in the volume config:

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

Note the extra space on the last line, that was causing the error. Correcting it to:

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

fixed it

like image 87
Will Avatar answered Nov 11 '22 10:11

Will