Ayo*_*oub 2 laravel composer-php reactjs dockerfile docker-compose
composer install我正在尝试使用 Docker 设置 React + Laravel 应用程序,但在 Docker 容器内运行命令时遇到问题。
当我运行时docker-compose up -d --build,构建在该composer install步骤失败,并出现以下错误:
“[后端 8/9] RUN Composer install --no-interaction --no-scripts --no-plugins: #0 0.537 Composer 插件已被禁用,以确保此非交互式会话中的安全。如果需要,请设置 COMPOSER_ALLOW_SUPERUSER=1允许插件以 root/超级用户身份运行。”
我尝试COMPOSER_ALLOW_SUPERUSER=1在各个地方添加环境变量,包括在 Dockerfile、docker-compose.yaml 文件中,甚至在运行时作为命令行参数docker-compose up。但是,我仍然遇到同样的错误。
这是我的 docker-compose.yaml 文件的示例:
version: '3'
services:
backend:
build:
context: .
dockerfile: Dockerfile
environment:
- COMPOSER_ALLOW_SUPERUSER=1
volumes:
- .:/app
# other service configuration...
Run Code Online (Sandbox Code Playgroud)
如果你想使用超级用户作曲家,你必须包括
ENV COMPOSER_ALLOW_SUPERUSER=1
Run Code Online (Sandbox Code Playgroud)
在 Dockerfile 中的composer install 命令之前。
但是,更安全的选择是使用非 root 用户(例如USER www-data在 Dockerfile 中)而不是超级用户。
| 归档时间: |
|
| 查看次数: |
7996 次 |
| 最近记录: |