Bitnami が提供する Laravel 6 Docker image を Windows WSL2 Docker で起動する

前提条件

Git bash が使えること、curlを使いたいので

手順

下記ページに

bitnami/laravel
https://hub.docker.com/r/bitnami/laravel

下の手順がある

$ mkdir ~/myapp && cd ~/myapp
$ curl -LO https://raw.githubusercontent.com/bitnami/bitnami-docker-laravel/master/docker-compose.yml
$ docker-compose up

基本的にその手順に従う
ディレクトリは作るとして、
Laravel 6を使いたい場合は、curlに指定するURLを 6用のdocker-compose.ymlファイルを指すようにする

$ curl -LO https://raw.githubusercontent.com/bitnami/bitnami-docker-laravel/master/6/debian-10/docker-compose.yml

参考
bitnami-docker-laravel/docker-compose.yml at master · bitnami/bitnami-docker-laravel · GitHub

ダウンロードできたdocker-compose.yml をテキストエディタで開き、Windows向けの下のコメントアウト部分を有効にする

# privileged: true # Privileged mode could be required to run this container under Windows

Docker を上げる

$ docker-compose up -d

最初に上げたときは下のようエラーがでた

Welcome to the Bitnami laravel container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-laravel
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-laravel/issues
Creating laravel application
cp: preserving times for '/app/.': Operation not permitted

もう1度上げたら立ち上がった
なぜ現象が解消したかは不明

Welcome to the Bitnami laravel container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-laravel
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-laravel/issues

Creating laravel application
cp: preserving times for '/app/.': Operation not permitted

Welcome to the Bitnami laravel container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-laravel
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-laravel/issues

Installing/Updating Laravel dependencies (composer)
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
41 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Dependencies installed
Connecting to mariadb at 172.20.0.2
Configuring the database
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (0.09 seconds)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (0.04 seconds)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (0.03 seconds)
Initialization finished
Laravel development server started: http://0.0.0.0:3000

以上です