LoginSignup
5
3

More than 5 years have passed since last update.

コンテナの外からartisanコマンドすると「Could not open input file: artisan」

Last updated at Posted at 2019-01-05

コンテナの外からartisanコマンドを打とうとすると「Could not open input file: artisan」というエラーが出る。

% docker-compose exec web php artisan --version
Could not open input file: artisan

コマンドを叩いてるディレクトリが違うということらしい。

LaravelでCould not open input file: artisanって言われたら

# Dockerfile
WORKDIR /var/www/html/laravel

DockerfileでWORKDIRをlaravelのルートディレクトリに指定してあげるとコンテナの外からコマンドが打てるようになる。

% docker-compose exec web php artisan --version
Laravel Framework 5.7.19
5
3
1

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
5
3