Skip to content

Commit 58b7f33

Browse files
committed
fix: check Docker availability before installation on Windows (WSL2 support)
1 parent 191c485 commit 58b7f33

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

cmd/install/main.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,70 @@ func success(msg string) { fmt.Printf("%s✓ %s%s\n", green, msg, reset) }
168168
func warn(msg string) { fmt.Printf("%s! %s%s\n", yellow, msg, reset) }
169169
func fail(msg string) { fmt.Printf("%s✗ %s%s\n", red, msg, reset); os.Exit(1) }
170170

171+
func checkDockerAvailable() {
172+
log("Checking Docker availability...")
173+
174+
// Check if docker command exists in PATH
175+
dockerPath, err := exec.LookPath("docker")
176+
if err != nil {
177+
if runtime.GOOS == "windows" {
178+
fmt.Println()
179+
fmt.Println("Docker CLI not found in PATH.")
180+
fmt.Println()
181+
fmt.Println("If you have Docker Desktop installed with WSL2 backend, you have two options:")
182+
fmt.Println()
183+
fmt.Println(" Option 1: Enable Docker CLI for Windows")
184+
fmt.Println(" 1. Open Docker Desktop")
185+
fmt.Println(" 2. Go to Settings > Resources > WSL Integration")
186+
fmt.Println(" 3. Enable 'Use the WSL 2 based engine'")
187+
fmt.Println(" 4. Restart Docker Desktop and try again")
188+
fmt.Println()
189+
fmt.Println(" Option 2: Run this installer inside WSL")
190+
fmt.Println(" 1. Open WSL terminal (wsl.exe)")
191+
fmt.Println(" 2. Download the Linux version of the installer")
192+
fmt.Println(" 3. Run the installer from within WSL")
193+
fmt.Println()
194+
fmt.Println(" Option 3: Use local services instead of Docker")
195+
fmt.Println(" Run: .\\ragcode-installer.exe -ollama=local -qdrant=remote")
196+
fmt.Println(" (Requires Ollama and Qdrant to be installed separately)")
197+
fmt.Println()
198+
fail("Docker CLI not available. See options above.")
199+
} else {
200+
fail("Docker not found. Please install Docker: https://docs.docker.com/get-docker/")
201+
}
202+
}
203+
204+
// Verify docker daemon is running
205+
cmd := exec.Command("docker", "info")
206+
if err := cmd.Run(); err != nil {
207+
if runtime.GOOS == "windows" {
208+
fmt.Println()
209+
fmt.Println("Docker daemon is not running or not accessible.")
210+
fmt.Println()
211+
fmt.Println("Please ensure:")
212+
fmt.Println(" 1. Docker Desktop is running")
213+
fmt.Println(" 2. Docker Desktop has finished starting (check system tray)")
214+
fmt.Println(" 3. If using WSL2 backend, ensure WSL integration is enabled")
215+
fmt.Println()
216+
fail("Docker daemon not accessible. Start Docker Desktop and try again.")
217+
} else {
218+
fail("Docker daemon not running. Please start Docker and try again.")
219+
}
220+
}
221+
222+
success(fmt.Sprintf("Docker available at %s", dockerPath))
223+
}
224+
171225
func main() {
172226
flag.Parse()
173227

174228
printBanner()
175229

230+
// 0. Check Docker availability if needed
231+
if *ollamaMode == "docker" || *qdrantMode == "docker" {
232+
checkDockerAvailable()
233+
}
234+
176235
// 1. Build and Install Binary
177236
if !*skipBuild {
178237
installBinary()

0 commit comments

Comments
 (0)