1
0

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 1 year has passed since last update.

既存laravelプロジェクトをsailでdockerに移行

Last updated at Posted at 2022-04-26

composer.jsonに以下の記載があればsailはインストール済み


    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^5.10",
        "phpunit/phpunit": "^9.5.10"
    },

記載なければ以下のコマンドでインストール bashで実行

composer require laravel/sail --dev

php artisan sail:install

Which services would you like to install? [mysql]:
  [0] mysql
  [1] pgsql
  [2] mariadb
  [3] redis
  [4] memcached
  [5] meilisearch
  [6] minio
  [7] mailhog
  [8] selenium

コンテナ環境に何をインストールするか選択する

0
または
0,3,4 //複数でも選択可能

Sail scaffolding installed successfully.//無事に実行されたら出る

以下WSL(ubntu)で実行

./vendor/bin/sail up -d

または

docker-compose up

「docker-compose up」と「./vendor/bin/sail up -d」は同義
http://localhost/ で動作確認

動作確認後に起きたエラー

The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file......
sudo chmod -R 777 storage

laravel\bootstrap\cache directory must be present and writable.

chmod 777 bootstrap/cache -R 
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?