【发布时间】:2020-01-10 21:02:01
【问题描述】:
我擅长创建 API,但在设置系统时不太好,我试图学习使用 docker 设置 laravel 并指的是: https://medium.com/@shakyShane/laravel-docker-part-1-setup-for-development-e3daaefaf3c
我正确地遵循了所有步骤,但在运行中:
docker-compose exec app php artisan key:generate
我收到错误:
Warning: require(/var/www/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/artisan on line 18
Fatal error: require(): Failed opening required '/var/www/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/artisan on line 18
我错误地认为这个问题是因为作曲家没有运行!
我的项目文件夹在桌面
我的 docker-compose.yml 是这样写的:
# The Application
`app:`
`build:`
`context: ./`
`dockerfile: app.dockerfile`
`working_dir: /var/www`
`volumes:`
`- ./:/var/www``
` environment:`
`- "DB_PORT=3306"`
`- "DB_HOST=database"`
# The Web Server
`web:`
`build:`
`context: ./`
`dockerfile: web.dockerfile`
`working_dir: /var/www`
`volumes_from:`
`- app`
`ports:`
`- 8080:80`
我在网上查看了其他解决方案,但我不太明白我需要怎么做。
【问题讨论】:
-
检查您在 .
/中的内容以及文件是否确实在/var/www中 -
@LinPy 里面什么都没有在 /var/www 下
标签: laravel docker ubuntu composer-php