MCPcopy Create free account
hub / github.com/FastLED/FastLED / _start_docker_windows

Function _start_docker_windows

ci/util/docker_helper.py:258–331  ·  view source on GitHub ↗

Attempt to start Docker Desktop on Windows with WSL2 backend diagnostics. Returns: Tuple of (success, message)

()

Source from the content-addressed store, hash-verified

256
257
258def _start_docker_windows() -> tuple[bool, str]:
259 """Attempt to start Docker Desktop on Windows with WSL2 backend diagnostics.
260
261 Returns:
262 Tuple of (success, message)
263 """
264 try:
265 # First, check if Docker is already running
266 if is_docker_available():
267 return True, "Docker is already running"
268
269 # Check WSL2 backend status
270 print(" Checking Docker Desktop WSL2 backend status...", flush=True)
271 wsl_running, wsl_message = _check_wsl2_docker_backend()
272 print(f" WSL2 Status: {wsl_message}", flush=True)
273
274 # If Docker Desktop is installed but WSL2 backend is stopped, restart it
275 if not wsl_running and "stopped" in wsl_message.lower():
276 print(
277 " Issue detected: Docker Desktop app may be running but WSL2 backend is stopped",
278 flush=True,
279 )
280 return _restart_docker_desktop_windows()
281
282 # Try to start Docker Desktop via the executable
283 docker_path = _find_docker_desktop_executable()
284
285 if docker_path:
286 try:
287 print(" Starting Docker Desktop...", flush=True)
288 subprocess.Popen(
289 [docker_path],
290 stdout=subprocess.DEVNULL,
291 stderr=subprocess.DEVNULL,
292 )
293 # Wait for Docker to start - Docker Desktop can take 60+ seconds
294 print(" Waiting for Docker Desktop to initialize...", flush=True)
295 # Try for up to 120 seconds (2 minutes)
296 for attempt in range(120):
297 time.sleep(1)
298 if is_docker_available():
299 # Verify WSL2 backend is also running
300 wsl_running, wsl_msg = _check_wsl2_docker_backend()
301 if wsl_running:
302 return True, "Docker Desktop started successfully"
303 else:
304 print(f" Warning: {wsl_msg}", flush=True)
305
306 # Print progress every 10 seconds
307 if (attempt + 1) % 10 == 0:
308 print(f" Still waiting ({attempt + 1}s)...", flush=True)
309
310 # If we got here, Docker didn't start properly - try restart
311 print(
312 " Docker Desktop didn't start properly, attempting full restart...",
313 flush=True,
314 )
315 return _restart_docker_desktop_windows()

Callers 1

attempt_start_dockerFunction · 0.85

Calls 6

is_docker_availableFunction · 0.90
printFunction · 0.50

Tested by

no test coverage detected