LoginSignup
10
3

More than 1 year has passed since last update.

Laravel Sail 導入時に発生したエラーと解決方法

Posted at

Laravel Sailを使ってLaravelをインストールしてみようとしたときのうっかりミスとその解決方法。

うっかり編

公式ページに書いてあるインストレーションを進める。

$ curl -s "https://laravel.build/example-app" | bash

docker: Error: remote trust data does not exist for docker.io/laravelsail/php80-composer: notary.docker.io does not have trust data for docker.io/laravelsail/php80-composer.
See 'docker run --help'.
bash: line 16: cd: example-app: No such file or directory

Please provide your password so we can make some final adjustments to your application's permissions.

Password:

Thank you! We hope you build something incredible. Dive in with: cd example-app && ./vendor/bin/sail up

エラーが表示されていたが「Thank you!」って言ってるし、進める。

$ cd example-app && ./vendor/bin/sail up
cd: no such file or directory: example-app

ディレクトリがないと言われるので、疑問に感じつつも、自分で作る。

$ mkdir example-app

モッカイヤッテミル。

$ cd example-app && ./vendor/bin/sail up
zsh: no such file or directory: ./vendor/bin/sail

エラー解決編

もう一度、最初のエラーを解決して進めます。

docker: Error: remote trust data does not exist for docker.io/laravelsail/php80-composer: notary.docker.io does not have trust data for docker.io/laravelsail/php80-composer.

上記のエラーは、こちらの記事によるとDockerのセキュリティ機能DOCKER_CONTENT_TRUST(DCT)が有効になっているというのがエラーの原因でした。

# 環境変数を設定。
$ export DOCKER_CONTENT_TRUST=0

# もう一度実行。
$ curl -s "https://laravel.build/example-app" | bash

# インストレーションが進む中に以下のテキストが、、、!
Application already exists!

先ほど、ディレクトリを消し忘れておりました:disappointed:
自分で作ったexample-appを削除し、再度実行。

$ curl -s "https://laravel.build/example-app" | bash

無事、Laravelがインストールされました!

結論編

Laravel Sailはディレクトリは自動生成してくれるので、自分で作らないように。
あと、エラーがあっても
We hope you build something incredible. Dive in with: cd example-app && ./vendor/bin/sail up と進めてくるので注意です。

初歩的なミスでしたが誰かの参考になれば幸いです。

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