Reputation: 300
I am facing directory permission errors on all of my docker projects. And this is one of them in Laravel. I have run 'chown' for directory permissions on /var/www and shared my 'c' drive where host project files are. Is it related to windows local/domain user permissions ?
Dockerfile
FROM php:7.2-apache
COPY . /var/www
COPY ./vhosts.conf /etc/apache2/sites-available/000-default.conf
WORKDIR /var/www
ENV TERM xterm
COPY ./ssl/server.crt /etc/apache2/ssl/server.crt
COPY ./ssl/server.key /etc/apache2/ssl/server.key
RUN apt-get update
RUN apt-get install -y openssl zip unzip git
RUN docker-php-ext-install mbstring pdo pdo_mysql mysqli && chown -R www-data:www-data /var/www
RUN docker-php-ext-install -j$(nproc) tokenizer bcmath ctype
RUN a2enmod rewrite
RUN a2enmod ssl
RUN service apache2 restart
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
EXPOSE 80
EXPOSE 443
Upvotes: 2
Views: 722
Reputation: 1106
Check which user is used to run your application. Since you mount your volume via command-line, the folder will be mounted as the docker
-user. The docker
-user will probably have other permissions than the user that runs the app e.g. the àpp`-user cannot write to the mounted folder.
Upvotes: 1