31
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

DockerでLaravelを入れているとPermissionDeniedエラーが出た

Posted at

こちらの記事を参考にDocker環境を構築していたのですが…
Laravelを

docker-compose exec app bash
composer create-project --prefer-dist "laravel/laravel=8.*" .

で入れた後

http://127.0.0.1:10080/
にアクセスしたところ……

The stream or file "/work/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

image.png

PermissionDeniedと言われてしまった…
Dockerがどっかーんですね。

##解決策
権限まわりの問題なので権限を与えてあげれば良いのです。
「パンがなかったらバター入りのお菓子を食べればいいのに」と同じで「権限がなかったらchownコマンドを打てばいいのに」ってやつです。

Dockerコンテナの中に

docker-compose exec app bash

で入って

chown www-data storage/ -R     

chownコマンドで権限を与えると…………

image.png

##できました!!!!

31
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?