1
votes

I have my docker-compose.yml file. I have container with php7.3-fpm and nginx. In my docker-compose.yml file I have volumes like

    `volumes:
        - ./:/var/www/html/email-sender`

This volumes is the same attached to nginx and php container. Everything work fine but when I try check in my php script if any directory exist (in /var/www/html/email-sender/my-awesome-directory) PHP function (is_dir or dir) return false. I checked permissions and every directory have 777 and www-data owner. Any ide? I attache my docker-compose.yml file and Dockerfile


services:
    php:
        build: docker/build
        environment:
            COMPOSER_ALLOW_SUPERUSER: 1
            XDEBUG_CONFIG: "remote_host=192.168.0.104"
            PHP_IDE_CONFIG: "serverName=PHPSTORM"
        volumes:
            - ./:/var/www/html/email-sender

    web:
        image: nginx:latest
        ports:
            - "8080:80"
        volumes:
            - ./:/var/www/html/email-sender
            - php

And Dockerfile


RUN apt-get update && apt-get install -yq git zip unzip libpng-dev  libzip-dev libpq-dev mc && \
    docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && \
    docker-php-ext-install mysqli pdo pdo_mysql pdo_pgsql zip bcmath  && \
    echo "date.timezone = Europe/Warsaw" > /usr/local/etc/php/php.ini && \
    rm -rf /var/lib/apt/lists/* && \
    php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" && \
    php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
    rm -rf /tmp/composer-setup.php && \
    pecl install xdebug && \
    docker-php-ext-enable xdebug

WORKDIR /var/www/html/email-sender/
RUN chown -R www-data:www-data /var/www/html/email-sender
USER www-data
1
Did you find a solution to your problem ? - systemasis

1 Answers

0
votes

If you are using the version 2 of docker-compose you can use this in your web container :

    volumes_from:
        - php

Just add this line before services

version: '2'