При запуске контейнеров докер создает папку src (папка проекта) только для чтения, как можно задать права root для этой папки?
docker-compose.yml
version: '3'
services:
database:
build:
context: ./containers/database
environment:
- MYSQL_DATABASE=${DATABASE_NAME}
- MYSQL_USER=${DATABASE_USER}
- MYSQL_PASSWORD=${DATABASE_PASSWORD}
- MYSQL_ROOT_PASSWORD=${DATABASE_ROOT_PASSWORD}
ports:
- "33063:3306"
volumes:
- ./containers/database/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./containers/database/data:/var/lib/mysql
php-fpm:
build:
context: ./containers/php-fpm
depends_on:
- database
environment:
- APP_ENV=${APP_ENV}
- APP_SECRET=${APP_SECRET}
- DATABASE_URL=mysql://${DATABASE_USER}:${DATABASE_PASSWORD}@database:3306/${DATABASE_NAME}?serverVersion=5.7
volumes:
- ./src:/var/www
nginx:
build:
context: ./containers/nginx
volumes:
- ./src:/var/www
- ./containers/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./containers/nginx/sites/:/etc/nginx/sites-available
- ./containers/nginx/conf.d/:/etc/nginx/conf.d
- ./containers/logs:/var/log
depends_on:
- php-fpm
ports:
- "8020:80"
Dockerfiles
nginx:
FROM nginx:alpine
WORKDIR /var/www
CMD ["nginx"]
EXPOSE 80
db:
FROM mariadb:latest
CMD ["mysqld"]
EXPOSE 3306
php-fpm:
FROM php:fpm-alpine
COPY wait-for-it.sh /usr/bin/wait-for-it
RUN chmod +x /usr/bin/wait-for-it
RUN apk --update --no-cache add git
RUN docker-php-ext-install pdo_mysql
COPY --from=composer /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
CMD composer install ; wait-for-it database:3306 -- bin/console doctrine:migrations:migrate ; php-fpm
RUN apk add bash
RUN wget https://get.symfony.com/cli/installer -O - | bash && \
mv /root/.symfony/bin/symfony /usr/local/bin/symfony
RUN /var/www
EXPOSE 9000