# VS Code Docker Extension Error

The Docker extension shows "Docker not found" or containers don't appear in the sidebar. Image builds fail from VS Code but work from terminal, or the extension can't connect to the Docker daemon. Docker development in VS Code streamlines container workflows, but when the extension breaks, you lose that integration.

Identifying Docker Extension Problems

Common error patterns:

  • "Docker command not found"
  • "Cannot connect to Docker daemon"
  • Containers list is empty despite running containers
  • Build image fails with permission errors
  • "Error response from daemon" messages in Output

Step 1: Verify Docker Installation

VS Code needs Docker CLI accessible:

Check Docker: ``bash docker --version docker ps docker info

If these commands fail, Docker isn't installed or configured correctly.

Install Docker: - Windows: Docker Desktop for Windows - macOS: Docker Desktop for Mac - Linux: Docker Engine + docker-compose

Verify Docker is running: ``bash # Check daemon status systemctl status docker # Linux # Docker Desktop shows whale icon in system tray/menu bar

Step 2: Configure Docker Path

If Docker is installed but VS Code can't find it:

Set Docker path explicitly: ``json // In settings.json { "docker.dockerPath": "/usr/local/bin/docker" // macOS // or on Windows: "docker.dockerPath": "C:\\Program Files\\Docker\\Docker\\resources\\bin\\docker.exe" }

Verify path: ``bash which docker # macOS/Linux where docker # Windows

Step 3: Fix Docker Daemon Connection

"Cannot connect to Docker daemon" errors:

Linux permissions: ```bash # Add user to docker group sudo usermod -aG docker $USER

# Logout and login again, or: newgrp docker

# Test docker ps ```

Docker not running: ``bash # Start Docker daemon sudo systemctl start docker # Linux sudo systemctl enable docker # Enable at boot

Windows/macOS: Docker Desktop must be running. Check the whale icon.

Socket permission: ```bash # Check socket permissions ls -la /var/run/docker.sock

# Fix if needed sudo chmod 666 /var/run/docker.sock ```

Step 4: Fix Context/Host Configuration

VS Code might be using wrong Docker context:

Check contexts: ``bash docker context ls

Use default context: ``bash docker context use default

Configure Docker host: ``json { "docker.host": "tcp://localhost:2375" }

For Docker Desktop, use default socket (no host setting needed).

Step 5: Handle Docker Desktop Issues

Docker Desktop specific problems:

  1. 1.WSL 2 backend (Windows):
  2. 2.Ensure WSL 2 is configured:
  3. 3.Docker Desktop Settings → General → "Use WSL 2 based engine"
  4. 4.Resources → WSL Integration → Enable for your distro

Memory/CPU limits: Docker Desktop Settings → Resources: - Increase memory if builds fail - Ensure CPUs allocated

  1. 1.Reset Docker Desktop:
  2. 2.If completely broken:
  3. 3.Docker Desktop → Troubleshoot → Reset to factory defaults
  4. 4.This deletes all containers and images

Step 6: Fix Image Build Issues

Builds fail in VS Code but work in terminal:

Check build settings: ``json { "docker.buildArgs": {}, "docker.buildPath": "${workspaceFolder}", "docker.showBuildOutput": "always" }

Permission issues: ```bash # Check if Dockerfile is readable ls -la Dockerfile

# Check context directory ls -la . ```

Dockerfile location: ``json { "docker.dockerfile": "build/Dockerfile" }

Step 7: Fix Container View Issues

Containers don't appear despite being running:

Refresh Docker view: Docker sidebar → Refresh button (or Ctrl+Shift+P → "Docker: Refresh")

Check Docker CLI: ```bash # Verify containers are running docker ps -a

# If containers show here but not in VS Code, it's an extension issue ```

Restart extension: ``bash code --uninstall-extension ms-azuretools.vscode-docker # Restart VS Code code --install-extension ms-azuretools.vscode-docker

Step 8: Handle Compose Issues

Docker Compose not working:

Install docker-compose: ```bash # Check if installed docker-compose --version

# Install if missing pip install docker-compose # or via package manager sudo apt install docker-compose ```

Configure compose path: ``json { "docker.composePath": "/usr/local/bin/docker-compose" }

Compose file location: ``json { "docker.composeFile": "docker-compose.yml" }

Step 9: Check for Extension Conflicts

Other Docker-related extensions can conflict:

List Docker extensions: ``bash code --list-extensions | grep docker

Potential conflicts: - Multiple Docker extensions - Dev Containers extension (should work together though)

Disable non-essential Docker extensions and test.

Verification

Test Docker extension works:

  1. 1.Open Docker sidebar (Ctrl+Shift+P → "Docker: Focus on Containers View")
  2. 2.Should see any running containers
  3. 3.Right-click container → should see options (logs, stop, etc.)
  4. 4.Open Dockerfile → "Docker: Build Image" should work
  5. 5.Output → "Docker" should show build logs

Quick Reference

ProblemCauseSolution
Docker not foundNot installed or PATHInstall Docker, set dockerPath
Daemon connection failedPermissions or daemon downAdd user to group, start daemon
Empty container listExtension refresh neededRefresh sidebar, restart extension
Build failsPermissions or pathCheck Dockerfile access, buildPath
Compose not foundNot installedInstall docker-compose

Docker extension issues usually stem from Docker itself - installation, permissions, or daemon status. Fix Docker first, then the extension works.