Forum Discussion
How to write a script to start a Docker container and stop WSL safely when the container stops?
There's no single, generic way to know that.
At best, there might be a way that's specific to the exact application/service you're working with, but for another application/service, it might require a completely different approach - or there may be no way at all. It's not like Windows prescribes a standard that client processes have to confirm to/integrate with.
Take Docker, for example. If the "Docker Desktop" you're launching were to in turn launch (or stop) child processes of its own, then you could leverage that behaviour. But let's say it doesn't, then you may have no visibility into how it's going with its start-up routine at which point all you can do is wait an arbitrary interval (or variations of that such as polling, but this isn't always materially any better).
Cheers,
Lain
- ookerSep 06, 2023Copper Contributor
I see. So if an app wants to implement this, what would be the way for it to do so? What teens should I look for?
- LainRobertsonSep 07, 2023Silver Contributor
I don't quite understand the question. What are teens? (Excluding rambunctious kids.)
Cheers,
Lain
- ookerSep 07, 2023Copper Contributor
oh it's autocorrect
. I was asking "what terms should I look for?"