INNER CODE UNIT · Go

waitForDockerDesktopWSL2Integration

ddev/ddev · winpkg/installer_test.go:80

func waitForDockerDesktopWSL2Integration(t *testing.T, distro string) bool {
	t.Helper()
	// Poll briefly before resorting to a Docker Desktop restart. Give Docker Desktop
	// ~40s to inject integration naturally after sanetestbot.sh starts it. If it
	// hasn't appeared by then, restart-docker-desktop.sh (stop+start) reliably
	// restores it in another ~30s.
	const quickAttempts = 4
	const delay = 10 * time.Second

	for attempt := 1; attempt <= quickAttempts; attempt++ {
		// When Docker Desktop integration is active it symlinks /usr/bin/docker →
		// /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker (a real Linux binary).
		// When inactive, /usr/bin/docker does not exist; PATH falls through to the
		// /Docker/host/bin/docker stub which outputs the "integration not enabled" error.
		out, err := exec.RunHostCommand("wsl.exe", "-d", distro, "--", "docker", "ps")
		if err == nil {
			// docker ps works — also verify Docker API is fully ready via docker info.
			// docker ps can succeed while Docker Desktop is still initializing; the

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…