Unable to write to files from php-fpm

I’m completely blank when it comes to Docker, but I am intrigued.

I’ve been trying for hours trying to get my PHP image to be able to write to a volume, but I can’t figure out to fix it.

PHP reports: The stream or file "/var/www/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

It’s running inside a VirtualBox Virtual Machine (Ubuntu 18.04) from MacOS High Sierra. I’m using the Virtual Machine as a testing platform for experimenting with an idea I have.

The Dockerfilefor my PHP image

FROM php:7.2-fpm-alpine

RUN apk add --no-cache --virtual .build-deps \
        $PHPIZE_DEPS \
        curl-dev \
        imagemagick-dev \
        libtool \
        libxml2-dev \
        postgresql-dev \
        sqlite-dev \
    && apk add --no-cache \
        curl \
        git \
        imagemagick \
        mysql-client \
        postgresql-libs \
        libintl \
        icu \
        icu-dev \
    && pecl install imagick \
    && docker-php-ext-enable imagick \
    && docker-php-ext-install \
        curl \
        iconv \
        mbstring \
        pdo \
        pdo_mysql \
        pdo_pgsql \
        pdo_sqlite \
        pcntl \
        tokenizer \
        xml \
        zip \
        intl \
    && curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \
    && apk del -f .build-deps
    
RUN chmod -R 755 /var/www && chown -R www-data:www-data /var/www

WORKDIR /var/www

The section from my docker-compose.yml:

  php:
    build:
      context: ./php/7.2
    volumes:
      - ./site:/var/www/
      - $HOME/.composer/:$HOME/.composer/

Any help from any Docker gurus would be greatly appreciated!