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

13,425

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

Share:
13,425
Admin
Author by

Admin

Updated on June 09, 2022

Comments

  • Admin
    Admin almost 2 years

    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>