When Closing Local, it crashes Docker

Bug Summary

When closing local app, and Docker is running, Local seems to try and force Docker to stop which then causes “docker service pl061 failed: poweroff requested” error in Docker and essentially crashes Docker.

Environment Info

Describe your environment.

  • What Operating System are you using? MBP M3 Sequoia V15.5
  • What version of Local is installed? Version 9.2.8+6882

Local does have some logic to try and detect and kill any long-running rogue processes when it’s quit, but looking at the code, there isn’t anything specifically targeting docker.

Can you describe a little more where you’re seeing that error message?

  • Is that within the terminal of a running container?
  • If it is within a container, what kind of container is it? A webserver (like apache or nginx?)
  • What port(s) are the container(s) listening on?
  • When looking at the process list, what is the cmd that the docker process is running? See below for what I have:

Without knowing exactly what docker process is being killed, here’s what I run to list all the processes that contain the word ‘docker’ – can you provide the docker processes on your machine?

ps -x | awk 'NR == 1 || $0 ~ /docker/'

I’ll get a screenshot later today. But overall, it generates an error in Docker Desktop and crashes Desktop.

So when I close LocalWP, and I am running Docker desktop, this is what I get. It isn’t much information, but there is something with how LocalWP is trying to do something that causes the crash.

After googling a bit to try and better understand what “service pl061” might be related to, the only thing I’ve come up with is that it might be related to an arm specification:

That doesn’t really offer us much, but I suppose it could be related somehow because M4 chips are arm-based.

I still haven’t been able to replicate on my M1 mac. I’d be curious what the Docker Desktop processes look like – maybe there’s something I can spot that might be caught by Local’s process cleanup task.

Can you run start Docker Desktop, Local, and the typical kinds of containers you have running and then run this command in the terminal?

ps awwxo "pid,ppid,uid,%cpu,%mem,comm,args" | grep -E 'extraResources|lightning-services|Local Sites|app-node|Local/run|Local Beta/run'

When I run that command, I only get things that Local has spawned, despite having a couple of nginx containers running within a started site:

So to test, I launched Local and then launched Docker Desktop. I didn’t do anything else other than close Local and it seems like it is trying to shut down Docker desktop as well. I see the following message in Desktop after closing Local.

It then says Docker stopped

I then get the desktop crashed message I shared before.

Here is the output from the command call

Thanks for these screenshots, @rbaugh.

They show that Docker Desktop is mounting your Local Sites directory as a virtual filesystem on launch, which is why Local is accidentally catching it in its cleanup process when you quit Local.

Do you see the Local Sites directory in Docker Desktop at Settings → Resources → File sharing?

If so, does removing it from the list and restarting Docker solve the issue with Docker Desktop shutting down when you quit Local? (If that’s it, we can look into tightening up our shutdown process so it doesn’t catch Docker.)

Thanks @nickc for that information.

Removing that directory from the file share seems like it might fix the issue.

Thanks so much for working with us and getting to the root cause @rbaugh !

We’ve started brainstorming ways that Local can be better about process management and now have a ticket in the backlog to make things better. This forum post has been so helpful in informing that work!