挂载共享文件夹后更改docker目录权限

时间:2017-11-03 12:07:38

标签: php docker-compose

我有一个PHP项目,需要我更改/ storage文件夹的所有者:

这是我的docker-compose.yml

version: '2'
services:
web:
    build:
        context: ./
        dockerfile: ./docker/web.docker
    volumes:
        - ./:/var/www
    ports:
        - "8080:80"
    links:
        - app


app:
    build:
        context: ./
        dockerfile: ./docker/app.docker
    volumes:
        - ./:/var/www
    links:
        - database
    environment:
        - "DB_PORT=3306"
        - "DB_HOST=database"
        - "REDIS_PORT=6379"
        - "REDIS_HOST=cache"

app.docker

FROM php:7.1-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
&& docker-php-ext-install mcrypt pdo_mysql bcmath

WORKDIR /var/www

RUN chown www-data:www-data -R /var/www/storage/

事情是,当运行chown www-data:www-data时,我猜文件夹仍未安装,因此我收到以下错误:

chown: cannot access '/var/www/storage/': No such file or directory

我怎样才能解决这个问题?挂载共享文件夹后是否有挂钩来运行命令?

0 个答案:

没有答案