0

I'm using docker-compose to build a Magento 2.3.1 development environment (Docker for Windows with Linux containers enabled).

The stack is based on PHP:7.2-apache with all Magento required extensions and MySQL 5.7.

The readiness test is successful, the database connection is okay, however, I get a fatal error when the installation starts :

Fatal error: Uncaught RuntimeException: The path "/var/www/html/generated/code/Magento/Framework/App/Config/InitialConfigSource/Proxy.php.20" cannot be renamed into "/var/www/html/generated/code/Magento/Framework/App/Config/InitialConfigSource/Proxy.php" Warning!rename(/var/www/html/generated/code/Magento/Framework/App/Config/InitialConfigSource/Proxy.php.20,/var/www/html/generated/code/Magento/Framework/App/Config/InitialConfigSource/Proxy.php): No such file or directory Class Magento\Framework\App\Config\InitialConfigSource\Proxy generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only. in /var/www/html/vendor/magento/framework/Code/Generator.php:135 Stack trace: #0 /var/www/html/ve in /var/www/html/vendor/magento/framework/Code/Generator.php on line 135

It's obvious that it's a file permission issue, but I'm not sure how and where I can fix this, so any help will be highly appreciated !


My webserver in docker-compose :

version: "3"

services:
  webserver:
    build: 
      context: ./bin/webserver
    container_name: '7.2.x-webserver'
    volumes: 
      - ${DOCUMENT_ROOT-./www}:/var/www/html
      - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
      - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
      - ${LOG_DIR-./logs/apache2}:/var/log/apache2
...

My webserver Dockerfile :

FROM php:7.2-apache

RUN apt-get -y update --fix-missing
RUN apt-get upgrade -y

# Install tools & libraries
RUN apt-get -y install apt-utils nano wget dialog \
    build-essential git curl libcurl3 libcurl3-dev zip

# Install important libraries
RUN apt-get -y install --fix-missing apt-utils build-essential git curl libcurl3 libcurl3-dev zip \
    libmcrypt-dev libsqlite3-dev libsqlite3-0 mysql-client zlib1g-dev \
    libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
    libxslt-dev

# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# PHP Extensions
RUN pecl install xdebug \
    && docker-php-ext-enable xdebug \
    && pecl install mcrypt-1.0.2 \
    && docker-php-ext-enable mcrypt \
    && docker-php-ext-install pdo_mysql \
    && docker-php-ext-install pdo_sqlite \
    && docker-php-ext-install mysqli \
    && docker-php-ext-install curl \
    && docker-php-ext-install tokenizer \
    && docker-php-ext-install json \
    && docker-php-ext-install zip \
    && docker-php-ext-install -j$(nproc) intl \
    && docker-php-ext-install mbstring \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd \
    && pecl install redis \
    && docker-php-ext-enable redis \
    && docker-php-ext-install bcmath \
    && docker-php-ext-install xsl \
    && docker-php-ext-install soap

# Enable apache modules
RUN a2enmod rewrite headers

# Fix Files Permissions
RUN chown -R www-data:www-data /var/www/
RUN chmod -R 775 /var/www/

ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
  • Some solution was found? – BraDev Oct 9 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.