0
votes

I've dockerized Apache + MySQL correctly and also managed to hit the setup installation page for Magento. But I'm having issues with managing a host <-> container data volume.

Magento is creating read-only log files on the volume, but the installation then returns an error saying the log file is not writeable in the later steps of the installation process.

My suspicions are that Docker's ACL automatically sets new files to read-only, but after it reads it from the volume again it is not writeable and returns an error.

Does anyone know an elegant way of solving this issue?

docker-compose.yml:

apache:
    build: .
    dockerfile: Dockerfile
    command: "/usr/sbin/apache2 -D FOREGROUND"
    volumes:
       - ./src/magento:/var/www/site
    environment:
        APACHE_RUN_USER: www-data
        APACHE_RUN_GROUP: www-data
        APACHE_LOCK_DIR: /var/lock/apache2
        APACHE_LOG_DIR: /var/log/apache2
        APACHE_PID_FILE: /var/run/apache2.pid
    ports:
        - "80:80"

mysqldb:
  image: mysql
  ports:
    - "3306:3306"
  environment:
    MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
    MYSQL_ROOT_PASSWORD: pass
    MYSQL_DATABASE: magento

Dockerfile:

FROM ubuntu

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y \
    apache2 php curl libapache2-mod-php7.0 \
    php7.0 php7.0-mysql php7.0-mcrypt \
    php7.0-mbstring php7.0-cli php7.0-gd \
    php7.0-curl php7.0-xml php7.0-zip php7.0-intl sudo

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

RUN a2enmod php7.0
RUN a2enmod rewrite

ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf

RUN mkdir -p /var/www/site
ADD src/magento /var/www/site


WORKDIR /var/www/site

EXPOSE 80

Error output during installation which stalls at 0%:

The path "install.log:///var/www/site/var/log/var/www/site/var/log/" is not writable
1

1 Answers

0
votes

Try adding the following line in your dockerfile and restart the process:

VOLUME /var/www/site