LoginSignup
0
1

More than 3 years have passed since last update.

【Docker・Laravel】コンテナの中でartisanコマンドを実行する方法

Posted at

個人メモです。

Dockerコンテナの中で複数のプロジェクトを展開している場合にartisanコマンドを実行する方法。

コンテナの中に入ってすぐにphp artisan config:cacheが使えない場合、コンテナの中で該当するプロジェクトのルートディレクトリに移動する必要がある。

$ docker exec -it コンテナ名 bash

bash-4.2# cd projects/src/プロジェクトディレクトリ 
bash-4.2#
bash-4.2# php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!

コンテナ内でディレクトリを移動してもプロンプトは変わらない。


参考: ディレクトリを移動しない場合はエラーになる

$ docker exec -it コンテナ名 bash

bash-4.2# php artisan config:cache
Could not open input file: artisan
0
1
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
0
1