Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 获取权限错误/var/www/html/laravel/storage/logs/laravel-2020-09-17.log on docker_Linux_Laravel_Docker_Nginx - Fatal编程技术网

Linux 获取权限错误/var/www/html/laravel/storage/logs/laravel-2020-09-17.log on docker

Linux 获取权限错误/var/www/html/laravel/storage/logs/laravel-2020-09-17.log on docker,linux,laravel,docker,nginx,Linux,Laravel,Docker,Nginx,我得到这个标题错误。 我只是试着像这样调整PUID和PGID Dockerfile FROM php:7-fpm RUN apt-get update RUN apt-get install -y libmcrypt-dev mariadb-client mcrypt git curl gnupg RUN curl -sL https://deb.nodesource.com/setup_8.x | bash RUN apt-get install -y nodejs RUN docker-p

我得到这个标题错误。 我只是试着像这样调整PUID和PGID

Dockerfile

FROM php:7-fpm

RUN apt-get update
RUN apt-get install -y libmcrypt-dev mariadb-client mcrypt git curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install -y nodejs
RUN docker-php-ext-install pdo_mysql
RUN apt-get install -y vim
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
ARG PUID=501
ENV PUID ${PUID}
ARG PGID=501
ENV PGID ${PGID}

RUN echo "-> $PUID"
RUN echo "-> $PGID"

RUN groupmod -o -g $PGID www-data && \
    usermod -o -u $PUID -g www-data www-data

RUN chown -R www-data:www-data /var/www
RUN chmod 755 /var/www
RUN sed -ri 's/^www-data:x:82:82:/www-data:x:1000:50:/' /etc/passwd

WORKDIR /var/www/html

COPY ./php.ini /usr/local/etc/php/php.ini
但当我通过此命令检查id时,它返回“0”

❯ docker-compose exec web bash
root@fb5ea5f15097:/var/www/html# id -u $USER
0
我尝试在docker-compose.yml上设置这些ID

version: '3'

services:
  mysql:
    build: ./mysql
    image: mysql:5.6
    ports:
    - '3306:3306'
    environment:
    - MYSQL_DATABASE=fashion_cart
    - MYSQL_USER=test_user
    - MYSQL_PASSWORD=password
    - MYSQL_ROOT_PASSWORD=password
  redis:
    build: ./redis
    image: 'redis:alpine'
  nginx:
    build: ./nginx
    image: nginx:latest
    volumes:
    - web-sync:/var/www/html
    ports:
    - '80:80'
    links:
    - web
  web:
    build: ./php-fpm
    volumes:
    - web-sync:/var/www/html
    links:
    - mysql
    - redis
    environment:
    - PUID=501
    - PGID=501
volumes:
  web-sync:
    external: true
docker-compose.yml

version: '3'

services:
  mysql:
    build: ./mysql
    image: mysql:5.6
    ports:
    - '3306:3306'
    environment:
    - MYSQL_DATABASE=fashion_cart
    - MYSQL_USER=test_user
    - MYSQL_PASSWORD=password
    - MYSQL_ROOT_PASSWORD=password
  redis:
    build: ./redis
    image: 'redis:alpine'
  nginx:
    build: ./nginx
    image: nginx:latest
    volumes:
    - web-sync:/var/www/html
    ports:
    - '80:80'
    links:
    - web
  web:
    build: ./php-fpm
    volumes:
    - web-sync:/var/www/html
    links:
    - mysql
    - redis
    environment:
    - PUID=501
    - PGID=501
volumes:
  web-sync:
    external: true
但web容器仍获取“0”。 你知道这个解决方案吗