简体   繁体   English

Docker 不能实时反映变化(Laravel)

[英]Docker not reflecting changes real-time (Laravel)

I have Docker desktop ( 2.3.0.4 ) for Mac ( Catalina 10.15.6 ).我有适用于 Mac( Catalina 10.15.6 )的 Docker 桌面( 2.3.0.4 )。

What started happening recently is that my changes aren't reflected in real-time when looking from browser perspective.最近开始发生的事情是,从浏览器的角度来看,我的更改并未实时反映。

I have a Laravel app.我有一个 Laravel 应用程序。 When I am connected to the app container and when I do the change in my IDE, I notice the file being changed instantly within container as well, so the mapping part works well, however the browser sync happens in about a minute or so (sometimes faster, sometimes slower) which is really frustrating.当我连接到应用程序容器并在 IDE 中进行更改时,我注意到文件也在容器内立即更改,因此映射部分运行良好,但是浏览器同步发生在大约一分钟左右(有时更快,有时更慢)这真的令人沮丧。

For example this part of the code will dump the string within a browser:例如,这部分代码将在浏览器中转储字符串:

public function index()
{
    dd('I am here');
}

However changing to但是更改为

public function index()
{
    dd('I am there');
}

will require me to wait and wait... PHPStorm has auto-save feature enabled, but I do a CTRL-s just to be sure.将需要我等待和等待... PHPStorm 启用了自动保存功能,但为了确定,我做了一个 CTRL-s。

My Docker configuration has 6 cores available with 8GB RAM, having only 5 containers up and running (and we are talking minimal workload there).我的 Docker 配置有 6 个内核和 8GB RAM,只有 5 个容器启动并运行(我们说的是那里的工作量最小)。

I thought it might be due to some caching, but flushing cache didn't work, disabling service workers didn't work and incognito mode didn't work.我认为这可能是由于一些缓存,但刷新缓存不起作用,禁用服务人员不起作用并且隐身模式不起作用。 I always have the delay.我总是有延迟。

Also, to be sure it's not about the framework, I tried doing artisan optimize:clear frantically, but to no avail.另外,为了确保它与框架无关,我尝试疯狂地进行artisan optimize:clear ,但无济于事。

What can I do to improve the response time?我可以做些什么来改善响应时间? This is a debugging nightmare.这是调试的噩梦。

I think that is related to the browser cache If you are using chrome go to the Inspect tab and go to the network and check the "Disable cache" I think it will fix your problem我认为这和浏览器缓存有关

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM