Laravel10でsailコマンドを使ってDocker環境を作成しよう

Laravel

Laravelへのsailインストール

composer require laravel/sail –dev コマンド実施

PS C:\Users\sutar\PhpLaravel\example-app> composer require laravel/sail --dev
./composer.json has been updated
Running composer update laravel/sail
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

INFO Discovering packages.

laravel/sail ....................................................................................................... DONE
laravel/sanctum ............................................................................................. DONE
laravel/tinker .................................................................................................... DONE
nesbot/carbon .................................................................................................. DONE
nunomaduro/collision ..................................................................................... DONE
nunomaduro/termwind .................................................................................. DONE
spatie/laravel-ignition ................................................................................... DONE

83 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

INFO No publishable resources for tag [laravel-assets].

Found 6 security vulnerability advisories affecting 5 packages.
Run "composer audit" for a full list of advisories.
Using version ^1.41 for laravel/sail
PS C:\Users\sutar\PhpLaravel\example-app> php artisan vendor:publish --tag=laravel-assets --ansi --force

INFO No publishable resources for tag [laravel-assets].

PS C:\Users\sutar\PhpLaravel\example-app> php artisan sail:install

Which services would you like to install? [mysql]
mysql ......................................................................................................... 0
pgsql .......................................................................................................... 1
mariadb .................................................................................................... 2
mongodb ................................................................................................. 3
redis ........................................................................................................... 4
valkey ........................................................................................................ 5
memcached ............................................................................................. 6
meilisearch .............................................................................................. 7
typesense .................................................................................................. 8
minio .......................................................................................................... 9
mailpit ........................................................................................................ 10
selenium ................................................................................................... 11
soketi ........................................................................................................ 12
❯ 0

The system cannot find the path specified.

INFO Sail scaffolding installed successfully. You may run your Docker containers using Sail's "up" command.

➜ ./vendor/bin/sail up

WARN A database service was installed. Run "artisan migrate" to prepare your database:

➜ ./vendor/bin/sail artisan migrate

PS C:\Users\sutar\PhpLaravel\example-app> ./vendor/bin/sail up

/bin/bash: C:\Users\sutar\PhpLaravel\example-app\vendor\bin\/../laravel/sail/bin/sail: No such file or directory

bashコマンドがwindowsでエラーが発生する場合

bash ./vendor/laravel/sail/bin/sail upを使いましょう

PS C:\Users\sutar\PhpLaravel\example-app> bash ./vendor/laravel/sail/bin/sail up

Docker is not running. が表示される場合はDocker deaktopを起動してみてください

PS C:\Users\sutar\PhpLaravel\example-app> bash ./vendor/laravel/sail/bin/sail up

[+] Running 9/9
✔ mysql Pulled 25.7s
✔ 6a4a3ef82cdc Pull complete 7.0s
✔ 5518b09b1089 Pull complete 7.3s
✔ b6b576315b62 Pull complete 22.1s
✔ 349b52643cc3 Pull complete 22.1s
✔ abe8d2406c31 Pull complete 22.1s
✔ c7668948e14a Pull complete 22.1s
✔ c7e93886e496 Pull complete 22.1s
! laravel.test Warning Get "https://sail-8.3/v2/": dialing sail-8.3:443 container via direct connection because static system has ... 10.2s
Compose now can delegate build to bake for better performances
Just set COMPOSE_BAKE=true
[+] Building 318.8s (19/19) FINISHED docker:default
=> [laravel.test internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 3.58kB 0.0s
=> [laravel.test internal] load metadata for docker.io/library/ubuntu:24.04 2.8s
=> [laravel.test internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [laravel.test 1/13] FROM docker.io/library/ubuntu:24.04@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 5.0s
=> => resolve docker.io/library/ubuntu:24.04@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 0.0s
=> => sha256:3afff29dffbc200d202546dc6c4f614edc3b109691e7ab4aa23d02b42ba86790 424B / 424B 0.0s
=> => sha256:a04dc4851cbcbb42b54d1f52a41f5f9eca6a5fd03748c3f6eb2cbeb238ca99bd 2.30kB / 2.30kB 0.0s
=> => sha256:5a7813e071bfadf18aaa6ca8318be4824a9b6297b3240f2cc84c1db6f4113040 29.75MB / 29.75MB 1.7s
=> => sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 6.69kB / 6.69kB 0.0s
=> => extracting sha256:5a7813e071bfadf18aaa6ca8318be4824a9b6297b3240f2cc84c1db6f4113040 3.1s
=> [laravel.test internal] load build context 0.0s
=> => transferring context: 1.12kB 0.0s
=> [laravel.test 2/13] WORKDIR /var/www/html 0.4s
=> [laravel.test 3/13] RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezone 0.3s
=> [laravel.test 4/13] RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && echo "Acquire::http::No-Cache true;" >> /etc/apt/apt 0.5s
=> [laravel.test 5/13] RUN apt-get update && apt-get upgrade -y && mkdir -p /etc/apt/keyrings && apt-get install -y gnupg gosu curl ca-certificates 282.4s
=> [laravel.test 6/13] RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.3 0.3s
=> [laravel.test 7/13] RUN userdel -r ubuntu 0.6s
=> [laravel.test 8/13] RUN groupadd --force -g 1000 sail 0.6s
=> [laravel.test 9/13] RUN useradd -ms /bin/bash --no-user-group -g 1000 -u 1337 sail 0.6s
=> [laravel.test 10/13] COPY start-container /usr/local/bin/start-container 0.0s
=> [laravel.test 11/13] COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf 0.0s
=> [laravel.test 12/13] COPY php.ini /etc/php/8.3/cli/conf.d/99-sail.ini 0.0s
=> [laravel.test 13/13] RUN chmod +x /usr/local/bin/start-container 0.4s
=> [laravel.test] exporting to image 24.8s
=> => exporting layers 24.8s
=> => writing image sha256:0bb8d5b75a6cb6e9ce7925fd6a3e0b57c33bdec68ac54c86388176aee5c37418 0.0s
=> => naming to sail-8.3/app 0.0s
=> [laravel.test] resolving provenance for metadata file 0.0s
[+] Running 5/5
✔ laravel.test Built 0.0s
✔ Network example-app_sail Created 0.0s
✔ Volume "example-app_sail-mysql" Created 0.0s
✔ Container example-app-mysql-1 Created 0.1s
✔ Container example-app-laravel.test-1 Created 0.1s
Attaching to laravel.test-1, mysql-1
mysql-1 | [Entrypoint] MySQL Docker Image 8.0.32-1.2.11-server
mysql-1 | [Entrypoint] Initializing database
mysql-1 | 2025-04-08T01:42:14.732472Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
mysql-1 | 2025-04-08T01:42:14.732575Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.32) initializing of server in progress as process 17
mysql-1 | 2025-04-08T01:42:14.741761Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
laravel.test-1 | 2025-04-08 01:42:15,096 INFO Set uid to user 0 succeeded
laravel.test-1 | 2025-04-08 01:42:15,098 INFO supervisord started with pid 1
mysql-1 | 2025-04-08T01:42:15.110581Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
laravel.test-1 | 2025-04-08 01:42:16,111 INFO spawned: 'php' with pid 16
mysql-1 | 2025-04-08T01:42:16.223993Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
laravel.test-1 | 2025-04-08 01:42:17,113 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
mysql-1 | [Entrypoint] Database initialized
mysql-1 | 2025-04-08T01:42:19.653427Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
mysql-1 | 2025-04-08T01:42:19.655930Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.32) starting as process 60
mysql-1 | 2025-04-08T01:42:19.670518Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
mysql-1 | 2025-04-08T01:42:19.805493Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysql-1 | 2025-04-08T01:42:20.046040Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
mysql-1 | 2025-04-08T01:42:20.046091Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
mysql-1 | 2025-04-08T01:42:20.061814Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
mysql-1 | 2025-04-08T01:42:20.061986Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.32' socket: '/var/lib/mysql/mysql.sock' port: 0 MySQL Community Server - GPL.
mysql-1 | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
mysql-1 | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
laravel.test-1 |
laravel.test-1 | INFO Server running on 
無効なURLです
. laravel.test-1 | laravel.test-1 | Press Ctrl+C to stop the server laravel.test-1 | mysql-1 | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it. mysql-1 | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. mysql-1 | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it. mysql-1 | mysql-1 | [Entrypoint] running /docker-entrypoint-initdb.d/10-create-testing-database.sh mysql-1 | mysql: [Warning] Using a password on the command line interface can be insecure. mysql-1 | mysql-1 | 2025-04-08T01:42:22.145446Z 15 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.32). mysql-1 | 2025-04-08T01:42:23.717126Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL. mysql-1 | [Entrypoint] Server shut down mysql-1 | mysql-1 | [Entrypoint] MySQL init process done. Ready for start up. mysql-1 | mysql-1 | [Entrypoint] Starting MySQL 8.0.32-1.2.11-server mysql-1 | 2025-04-08T01:42:24.349065Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead. mysql-1 | 2025-04-08T01:42:24.349727Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.32) starting as process 1 mysql-1 | 2025-04-08T01:42:24.355952Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. mysql-1 | 2025-04-08T01:42:24.441341Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. mysql-1 | 2025-04-08T01:42:24.560877Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. mysql-1 | 2025-04-08T01:42:24.560924Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. mysql-1 | 2025-04-08T01:42:24.576746Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock mysql-1 | 2025-04-08T01:42:24.576862Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.32' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL. Gracefully stopping... (press Ctrl+C again to force) [+] Stopping 2/2 ✔ Container example-app-laravel.test-1 Stopped 1.0s ✔ Container example-app-mysql-1 Stopped 1.3s PS C:\Users\sutar\PhpLaravel\example-app> wsl --list --verbose NAME STATE VERSION * Ubuntu Running 2 docker-desktop Running 2
PS C:\Users\sutar\PhpLaravel\message-board> composer require laravel/sail --dev
./composer.json has been updated
Running composer update laravel/sail
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 112 installs, 0 updates, 0 removals
- Downloading symfony/polyfill-ctype (v1.30.0)
- Downloading dragonmantank/cron-expression (v3.3.3)
- Downloading symfony/deprecation-contracts (v3.5.0)
- Downloading fakerphp/faker (v1.23.1)
- Downloading symfony/polyfill-php83 (v1.30.0)
- Downloading symfony/polyfill-mbstring (v1.30.0)
- Downloading symfony/http-foundation (v6.4.10)
- Downloading guzzlehttp/promises (2.0.3)
- Downloading symfony/polyfill-php80 (v1.30.0)
- Downloading laravel/pint (v1.17.2)
- Downloading symfony/polyfill-intl-normalizer (v1.30.0)
- Downloading symfony/polyfill-intl-grapheme (v1.30.0)
- Downloading symfony/string (v7.1.3)
- Downloading symfony/service-contracts (v3.5.0)
- Downloading symfony/console (v6.4.10)
- Downloading voku/portable-ascii (2.0.1)
- Downloading symfony/css-selector (v7.1.1)
- Downloading symfony/var-dumper (v6.4.10)
- Downloading symfony/polyfill-uuid (v1.30.0)
- Downloading symfony/uid (v6.4.8)
- Downloading symfony/routing (v6.4.10)
- Downloading symfony/process (v6.4.8)
- Downloading symfony/polyfill-php72 (v1.30.0)
- Downloading symfony/polyfill-intl-idn (v1.30.0)
- Downloading symfony/mime (v6.4.9)
- Downloading symfony/event-dispatcher-contracts (v3.5.0)
- Downloading symfony/event-dispatcher (v7.1.1)
- Downloading psr/log (3.0.0)
- Downloading symfony/mailer (v6.4.9)
- Downloading symfony/error-handler (v6.4.10)
- Downloading symfony/http-kernel (v6.4.10)
- Downloading symfony/finder (v6.4.10)
- Downloading nunomaduro/termwind (v1.15.1)
- Downloading symfony/translation-contracts (v3.5.0)
- Downloading symfony/translation (v6.4.10)
- Downloading monolog/monolog (3.7.0)
- Downloading league/mime-type-detection (1.15.0)
- Downloading league/flysystem (3.28.0)
- Downloading league/flysystem-local (3.28.0)
- Downloading nette/utils (v4.0.4)
- Downloading nette/schema (v1.3.0)
- Downloading league/commonmark (2.5.1)
- Downloading laravel/serializable-closure (v1.3.4)
- Downloading laravel/prompts (v0.1.24)
- Downloading laravel/framework (v10.48.19)
- Downloading symfony/yaml (v7.1.1)
- Downloading nikic/php-parser (v5.1.0)
- Downloading psy/psysh (v0.12.4)
- Downloading laravel/tinker (v2.9.0)
- Downloading filp/whoops (2.15.4)
- Downloading nunomaduro/collision (v7.10.0)
- Downloading sebastian/comparator (5.0.1)
- Downloading phpunit/php-code-coverage (10.1.15)
- Downloading myclabs/deep-copy (1.12.0)
- Downloading phpunit/phpunit (10.5.29)
- Downloading spatie/backtrace (1.6.2)
- Downloading spatie/flare-client-php (1.8.0)
- Downloading spatie/laravel-ignition (2.8.0)
- Installing doctrine/inflector (2.0.10): Extracting archive
- Installing doctrine/lexer (3.0.1): Extracting archive
- Installing symfony/polyfill-ctype (v1.30.0): Extracting archive
- Installing webmozart/assert (1.11.0): Extracting archive
- Installing dragonmantank/cron-expression (v3.3.3): Extracting archive
- Installing symfony/deprecation-contracts (v3.5.0): Extracting archive
- Installing psr/container (2.0.2): Extracting archive
- Installing fakerphp/faker (v1.23.1): Extracting archive
- Installing symfony/polyfill-php83 (v1.30.0): Extracting archive
- Installing symfony/polyfill-mbstring (v1.30.0): Extracting archive
- Installing symfony/http-foundation (v6.4.10): Extracting archive
- Installing fruitcake/php-cors (v1.3.0): Extracting archive
- Installing psr/http-message (2.0): Extracting archive
- Installing psr/http-client (1.0.3): Extracting archive
- Installing ralouphie/getallheaders (3.0.3): Extracting archive
- Installing psr/http-factory (1.1.0): Extracting archive
- Installing guzzlehttp/psr7 (2.7.0): Extracting archive
- Installing guzzlehttp/promises (2.0.3): Extracting archive
- Installing guzzlehttp/guzzle (7.9.2): Extracting archive
- Installing symfony/polyfill-php80 (v1.30.0): Extracting archive
- Installing guzzlehttp/uri-template (v1.0.3): Extracting archive
- Installing laravel/pint (v1.17.2): Extracting archive
- Installing symfony/polyfill-intl-normalizer (v1.30.0): Extracting archive
- Installing symfony/polyfill-intl-grapheme (v1.30.0): Extracting archive
- Installing symfony/string (v7.1.3): Extracting archive
- Installing symfony/service-contracts (v3.5.0): Extracting archive
- Installing symfony/console (v6.4.10): Extracting archive
- Installing voku/portable-ascii (2.0.1): Extracting archive
- Installing phpoption/phpoption (1.9.3): Extracting archive
- Installing graham-campbell/result-type (v1.1.3): Extracting archive
- Installing vlucas/phpdotenv (v5.6.1): Extracting archive
- Installing symfony/css-selector (v7.1.1): Extracting archive
- Installing tijsverkoyen/css-to-inline-styles (v2.2.7): Extracting archive
- Installing symfony/var-dumper (v6.4.10): Extracting archive
- Installing symfony/polyfill-uuid (v1.30.0): Extracting archive
- Installing symfony/uid (v6.4.8): Extracting archive
- Installing symfony/routing (v6.4.10): Extracting archive
- Installing symfony/process (v6.4.8): Extracting archive
- Installing symfony/polyfill-php72 (v1.30.0): Extracting archive
- Installing symfony/polyfill-intl-idn (v1.30.0): Extracting archive
- Installing symfony/mime (v6.4.9): Extracting archive
- Installing psr/event-dispatcher (1.0.0): Extracting archive
- Installing symfony/event-dispatcher-contracts (v3.5.0): Extracting archive
- Installing symfony/event-dispatcher (v7.1.1): Extracting archive
- Installing psr/log (3.0.0): Extracting archive
- Installing egulias/email-validator (4.0.2): Extracting archive
- Installing symfony/mailer (v6.4.9): Extracting archive
- Installing symfony/error-handler (v6.4.10): Extracting archive
- Installing symfony/http-kernel (v6.4.10): Extracting archive
- Installing symfony/finder (v6.4.10): Extracting archive
- Installing ramsey/collection (2.0.0): Extracting archive
- Installing brick/math (0.12.1): Extracting archive
- Installing ramsey/uuid (4.7.6): Extracting archive
- Installing psr/simple-cache (3.0.0): Extracting archive
- Installing nunomaduro/termwind (v1.15.1): Extracting archive
- Installing symfony/translation-contracts (v3.5.0): Extracting archive
- Installing symfony/translation (v6.4.10): Extracting archive
- Installing psr/clock (1.0.0): Extracting archive
- Installing carbonphp/carbon-doctrine-types (2.1.0): Extracting archive
- Installing nesbot/carbon (2.72.5): Extracting archive
- Installing monolog/monolog (3.7.0): Extracting archive
- Installing league/mime-type-detection (1.15.0): Extracting archive
- Installing league/flysystem (3.28.0): Extracting archive
- Installing league/flysystem-local (3.28.0): Extracting archive
- Installing nette/utils (v4.0.4): Extracting archive
- Installing nette/schema (v1.3.0): Extracting archive
- Installing dflydev/dot-access-data (v3.0.3): Extracting archive
- Installing league/config (v1.2.0): Extracting archive
- Installing league/commonmark (2.5.1): Extracting archive
- Installing laravel/serializable-closure (v1.3.4): Extracting archive
- Installing laravel/prompts (v0.1.24): Extracting archive
- Installing laravel/framework (v10.48.19): Extracting archive
- Installing symfony/yaml (v7.1.1): Extracting archive
- Installing laravel/sail (v1.41.0): Extracting archive
- Installing laravel/sanctum (v3.3.3): Extracting archive
- Installing nikic/php-parser (v5.1.0): Extracting archive
- Installing psy/psysh (v0.12.4): Extracting archive
- Installing laravel/tinker (v2.9.0): Extracting archive
- Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
- Installing mockery/mockery (1.6.12): Extracting archive
- Installing filp/whoops (2.15.4): Extracting archive
- Installing nunomaduro/collision (v7.10.0): Extracting archive
- Installing sebastian/version (4.0.1): Extracting archive
- Installing sebastian/type (4.0.0): Extracting archive
- Installing sebastian/recursion-context (5.0.0): Extracting archive
- Installing sebastian/object-reflector (3.0.0): Extracting archive
- Installing sebastian/object-enumerator (5.0.0): Extracting archive
- Installing sebastian/global-state (6.0.2): Extracting archive
- Installing sebastian/exporter (5.1.2): Extracting archive
- Installing sebastian/environment (6.1.0): Extracting archive
- Installing sebastian/diff (5.1.1): Extracting archive
- Installing sebastian/comparator (5.0.1): Extracting archive
- Installing sebastian/code-unit (2.0.0): Extracting archive
- Installing sebastian/cli-parser (2.0.1): Extracting archive
- Installing phpunit/php-timer (6.0.0): Extracting archive
- Installing phpunit/php-text-template (3.0.1): Extracting archive
- Installing phpunit/php-invoker (4.0.0): Extracting archive
- Installing phpunit/php-file-iterator (4.1.0): Extracting archive
- Installing theseer/tokenizer (1.2.3): Extracting archive
- Installing sebastian/lines-of-code (2.0.2): Extracting archive
- Installing sebastian/complexity (3.2.0): Extracting archive
- Installing sebastian/code-unit-reverse-lookup (3.0.0): Extracting archive
- Installing phpunit/php-code-coverage (10.1.15): Extracting archive
- Installing phar-io/version (3.2.1): Extracting archive
- Installing phar-io/manifest (2.0.4): Extracting archive
- Installing myclabs/deep-copy (1.12.0): Extracting archive
- Installing phpunit/phpunit (10.5.29): Extracting archive
- Installing spatie/error-solutions (1.1.1): Extracting archive
- Installing spatie/backtrace (1.6.2): Extracting archive
- Installing spatie/flare-client-php (1.8.0): Extracting archive
- Installing spatie/ignition (1.15.0): Extracting archive
- Installing spatie/laravel-ignition (2.8.0): Extracting archive
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

INFO Discovering packages.

laravel/sail ................................................................................................................................ DONE
laravel/sanctum ............................................................................................................................. DONE
laravel/tinker .............................................................................................................................. DONE
nesbot/carbon ............................................................................................................................... DONE
nunomaduro/collision ........................................................................................................................ DONE
nunomaduro/termwind ......................................................................................................................... DONE
spatie/laravel-ignition ..................................................................................................................... DONE

83 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

INFO No publishable resources for tag [laravel-assets].

Found 6 security vulnerability advisories affecting 5 packages.
Run "composer audit" for a full list of advisories.
Using version ^1.41 for laravel/sail
PS C:\Users\sutar\PhpLaravel\message-board> php artisan sail:install

Which services would you like to install? [mysql]
mysql .......................................................................................................................................... 0
pgsql .......................................................................................................................................... 1
mariadb ........................................................................................................................................ 2
mongodb ........................................................................................................................................ 3
redis .......................................................................................................................................... 4
valkey ......................................................................................................................................... 5
memcached ...................................................................................................................................... 6
meilisearch .................................................................................................................................... 7
typesense ...................................................................................................................................... 8
minio .......................................................................................................................................... 9
mailpit ....................................................................................................................................... 10
selenium ...................................................................................................................................... 11
soketi ........................................................................................................................................ 12
❯ 0

The system cannot find the path specified.

INFO Sail scaffolding installed successfully. You may run your Docker containers using Sail's "up" command.

➜ ./vendor/bin/sail up

WARN A database service was installed. Run "artisan migrate" to prepare your database:

➜ ./vendor/bin/sail artisan migrate

PS C:\Users\sutar\PhpLaravel\message-board> bash ./vendor/laravel/sail/bin/sail up -d

[+] Running 4/4
✔ Network message-board_sail Created 0.1s
✔ Volume "message-board_sail-mysql" Created 0.0s
✔ Container message-board-mysql-1 Started 0.6s
✔ Container message-board-laravel.test-1 Started 0.8s
PS C:\Users\sutar\PhpLaravel\message-board> php -v
PHP 8.2.0 (cli) (built: Dec 6 2022 15:31:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
PS C:\Users\sutar\PhpLaravel\message-board> which php
which: The term 'which' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

 


 

Windows 11でLaravel 10のSail環境を構築しWebサーバ起動する手順

以下はWindows 11でLocker Desktopを使用してLaravel 10のSail環境を構築する手順です。

前提条件

  • Windows 11 64bit (Pro, Enterprise, or Education版)
  • WSL2が有効になっていること
  • Docker Desktop for Windowsがインストール済み

手順

1. WSL2の有効化

  1. PowerShellを管理者権限で開く
  2. 以下のコマンドを実行:
    wsl --install
  3. 再起動を要求されるので、PCを再起動

2. Docker Desktopのインストールと設定

  1. Docker Desktop for Windowsをダウンロードしてインストール
  2. インストール後、Docker Desktopを起動
  3. 設定画面で「Use WSL 2 based engine」にチェックが入っていることを確認

3. Laravelプロジェクトの作成

  1. コマンドプロンプトまたはPowerShellを開く
  2. 以下のコマンドで新しいLaravelプロジェクトを作成:
    curl -s https://laravel.build/example-app | bash

    (または既存のプロジェクトがある場合はそのディレクトリに移動)

    ※ プロジェクト名を変更したい場合は example-app の部分を変更

4. Sailのセットアップ

  1. プロジェクトディレクトリに移動:
    cd example-app
  2. Sailをインストール:
    composer require laravel/sail --dev
  3. Sailの設定ファイルを公開:
    php artisan sail:install

    このコマンドでどのサービスを使うか聞かれるので、必要なものを選択(通常はデフォルトでOK)

5. 環境変数の設定

  1. .env ファイルを編集:
    APP_URL=http://localhost
    DB_HOST=mysql
    REDIS_HOST=redis

6. Sailの起動

  1. 以下のコマンドでコンテナをビルドして起動:
    ./vendor/bin/sail up -d

    (初回は時間がかかります)

7. アプリケーションの確認

  1. ブラウザで http://localhost を開く
  2. Laravelのウェルカムページが表示されれば成功

よく使うSailコマンド

  • コンテナの起動:
    ./vendor/bin/sail up -d
  • コンテナの停止:
    ./vendor/bin/sail down
  • Artisanコマンドの実行例(マイグレーション):
    ./vendor/bin/sail artisan migrate
  • Composerコマンドの実行例:
    ./vendor/bin/sail composer require package-name
  • コンテナ内のbashに入る:
    ./vendor

以上

タイトルとURLをコピーしました