0

My desktop is fresh install of Windows 11 (i9, 128GB RAM, SSDs), running Docker (v20.10.24) and Docker Desktop (v4.18) in WSL2 mode. I develop in Visual Studio Code (v1.77.3) and attach to the projects development folder.

In Docker, I have a Laravel project, with the project development files mapped to a local desktop location in my docker-compose:

volumes:
 
   - ./:/var/www/html

This gave me 10 second page load times with just "Hello World" as the content, but still loading all my vendor files in the background I assume. So i changed to this in my Dockerfile:

COPY /project/ /var/www/html

And from there I got load times measure in milliseconds. But of course my project development files are 'trapped' within the docker image now.

I cant run PHP on my Desktop, I need to run it within Docker. Is there a general better workflow or development process that will give me performance and flexibility in development?

Note: I am running Apache, not artisan serve.

Matt
  • 53
  • 1
  • 7
  • what is the current folder `./` referring to? if you run `pwd`, what is the absolute path to that `docker-compose.yml` file? – matiaslauriti Apr 23 '23 at 23:26
  • 1
    Is this the same issue as [Docker is extremely slow when running Laravel on Nginx container wsl2](https://stackoverflow.com/questions/63036490/docker-is-extremely-slow-when-running-laravel-on-nginx-container-wsl2)? That has a couple of suggestions around different setup, but fundamentally the bind-mount mechanism can be rather slow using Docker Desktop. – David Maze Apr 23 '23 at 23:43

1 Answers1

0

Could you map the volume like this:

volumes:
  - type: bind
    source: ./
    target: /var/www/html
Nick_O
  • 429
  • 5
  • 18
  • this halved the times of my requests, thanks. BUt still not in milliseconds. The comment from @david maze got me in the right direction. – Matt Apr 25 '23 at 06:37