最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Laravel Sail command is very slow compared to docker compose - Stack Overflow

programmeradmin4浏览0评论

I'm using Laravel Sail on a WSL2 instance, on Windows 11 (Home). The project I'm working on is installed in the WSL filesystem, as I always do.

After executing any sail command, there's a delay of ~10 seconds before the command output is shown.

I've noticed that running the same commands directly with docker compose, has a little delay(~1.5sec), but nothing compared to sail.

Docker Compose

$ time docker compose exec laravel.test php artisan

docker-compose exec laravel.test php artisan  0.04s user 0.02s system 1% cpu 3.323 total

Sail

$ time sail artisan

sh $([ -f sail ] && echo sail || echo vendor/bin/sail) artisan  0.27s user 0.29s system 5% cpu 9.623 total

Ok, now that's weird! time reports that sail is executing the command in 0.27s, but as you can see from the following screen recording, that's not the case at all!

Please, if you know what can be the cause of this, let me know.

  • I always used Laravel Sail / Docker without any problem, even if I'm using WSL (some people say it's slow, but I'm not of the same opinion).
  • I already checked other answers without any luck.
  • I'm not sure if this depends on my machine setup, or it's related to the version of the involved software.
  • The project is using Laravel 9.x and Laravel Sail 1.41
  • Before writing this post, I tried to switch my WSL instance from Ubuntu 22.04 to 24.04, but the problem persisted.

Thanks

I'm using Laravel Sail on a WSL2 instance, on Windows 11 (Home). The project I'm working on is installed in the WSL filesystem, as I always do.

After executing any sail command, there's a delay of ~10 seconds before the command output is shown.

I've noticed that running the same commands directly with docker compose, has a little delay(~1.5sec), but nothing compared to sail.

Docker Compose

$ time docker compose exec laravel.test php artisan

docker-compose exec laravel.test php artisan  0.04s user 0.02s system 1% cpu 3.323 total

Sail

$ time sail artisan

sh $([ -f sail ] && echo sail || echo vendor/bin/sail) artisan  0.27s user 0.29s system 5% cpu 9.623 total

Ok, now that's weird! time reports that sail is executing the command in 0.27s, but as you can see from the following screen recording, that's not the case at all!

Please, if you know what can be the cause of this, let me know.

  • I always used Laravel Sail / Docker without any problem, even if I'm using WSL (some people say it's slow, but I'm not of the same opinion).
  • I already checked other answers without any luck.
  • I'm not sure if this depends on my machine setup, or it's related to the version of the involved software.
  • The project is using Laravel 9.x and Laravel Sail 1.41
  • Before writing this post, I tried to switch my WSL instance from Ubuntu 22.04 to 24.04, but the problem persisted.

Thanks

Share Improve this question asked 14 hours ago funder7funder7 1,83121 silver badges33 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I ran into the same problem as you described and couldn’t figure out what caused the significant lag suddenly introduced when running sail artisan commands.

The issue started right after updating Docker Desktop to version 4.38.0, but since I had never experienced any issues after an update before, I didn’t immediately suspect it to be the cause.

After reading your post, I uninstalled Docker Desktop 4.38.0, downgraded back to 4.37.2, and rebuilt Sail without using cache.

After that, everything was back to the speed I was used to.

Hope that helps!

Kind regards

发布评论

评论列表(0)

  1. 暂无评论