在docker中的容器之间设置正确的权限

在docker中的容器之间设置正确的权限

我正在尝试为 WordPress 设置一个开发服务器,以便在前端和后端运行。到目前为止,我有这个

version: '3.2'
services:
  nginx:
    image: nginx:latest
    ports:
      - '8000:8000'
    depends_on:
      - wordpress
    volumes:
      - ./nginx:/etc/nginx/conf.d
      - wordpress-data:/var/www/html
  mysql:
    image: mysql:latest
    ports:
      - '3306:3306'
    volumes:
      - mysql-data:/var/lib/mysql:rw
    environment:
      - MYSQL_ROOT_PASSWORD=aqwe123
    restart: always
  wordpress-cli:
    image: wordpress:cli-1.2-php5.6
    depends_on:
      - mysql
      - wordpress
    pid: 'host'
    links:
      - mysql
    working_dir: /var/www/html
    volumes:
      - wordpress-data:/var/www/html
      - ./install-wp.sh:/var/www/install-wp.sh
      - ./wp-cli.yml:/var/www/html/wp-cli.yml
      - ./uploads:/var/www/html/wp-content/uploads
    entrypoint: /bin/sh
    command: /var/www/install-wp.sh
    environment:
      - WP_VER=4.8
      - WORDPRESS_DB_PASSWORD=aqwe123
    restart: on-failure
  wordpress:
    image: wordpress:php5.6-fpm
    depends_on:
      - mysql
    ports:
      - '9000:9000'
    working_dir: /var/www/html
    volumes:
      - wordpress-data:/var/www/html
      - ./wordpress/wp-content/themes/gblsf-parallax-one:/var/www/html/wp-content/themes/gblsf-parallax-one
    links:
      - mysql
    restart: always
volumes:
  wordpress-data: {}
  mysql-data:
    driver: local

当我实际使用 wo-cli 创建配置文件时,问题出现了

wordpress-cli_1 | 警告:file_put_contents(/var/www/html/wp-config.php):无法打开流:phar:///usr/local/bin/wp/vendor/wp-cli/config-command/src/Config_Command.php 第 145 行的权限被拒绝 wordpress-cli_1
错误:未找到“wp-config.php”。

根据 docker-compose 配置文件...我需要什么样的权限来解决当前发生的权限被拒绝错误

相关内容