title: Laravel with Sail and Docker, really slow
body: <p>I tried to run a fresh Laravel 9.2 project with Laravel Sail in Docker. (contains WSL2), and the index page is loaded in 2sec. For an existing project where I tried Sail to run on Docker, it takes ~7sec instead of 0.3 as it takes on Laravel Homestead.</p>
  <p>I find a similar post <a href="https://stackoverflow.com/questions/63036490/docker-is-extremely-slow-when-running-laravel-on-nginx-container-wsl2">here:</a> , but is still not working.</p>
  <ul>
  <li>I have tried Ubuntu, Ubuntu 20.04 is the same. On Ubuntu 18 I don't have
  in /mnt/c disk not sure why.</li>
  <li>I have tried to run on wsl 1, and disable <em><strong>Use the WSL 2 based engine</strong></em> from Docker, and to enable <em><strong>Expose daemon on tcp://localhost:2375 without TLS</strong></em>, but then when I try to run <code>./vendor/bin/sail up</code> is not working anymore &quot;Docker is not running&quot;, from what I checked on <a href="https://laravel.com/docs/9.x/sail" rel="nofollow noreferrer">Laravel page</a> , I need WSL2.</li>
  </ul>
  <p><em><strong>docker-compose.yml</strong></em> (generated by Laravel Sail)</p>
  <pre><code>version: '3'
  services:
      laravel.test:
          build:
              context: ./vendor/laravel/sail/runtimes/8.1
              dockerfile: Dockerfile
              args:
                  WWWGROUP: '${WWWGROUP}'
          image: sail-8.1/app
          extra_hosts:
              - 'host.docker.internal:host-gateway'
          ports:
              - '${APP_PORT:-80}:80'
          environment:
              WWWUSER: '${WWWUSER}'
              LARAVEL_SAIL: 1
              XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
              XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
          volumes:
              - '.:/var/www/html'
          networks:
              - sail
          depends_on:
              - mysql
      mysql:
          image: 'mysql/mysql-server:8.0'
          ports:
              - '${FORWARD_DB_PORT:-3306}:3306'
          environment:
              MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
              MYSQL_ROOT_HOST: &quot;%&quot;
              MYSQL_DATABASE: '${DB_DATABASE}'
              MYSQL_USER: '${DB_USERNAME}'
              MYSQL_PASSWORD: '${DB_PASSWORD}'
              MYSQL_ALLOW_EMPTY_PASSWORD: 1
          volumes:
              - 'sail-mysql:/var/lib/mysql'
          networks:
              - sail
          healthcheck:
              test: [&quot;CMD&quot;, &quot;mysqladmin&quot;, &quot;ping&quot;, &quot;-p${DB_PASSWORD}&quot;]
              retries: 3
              timeout: 5s
  networks:
      sail:
          driver: bridge
  volumes:
      sail-mysql:
          driver: local
  </code></pre>