# Fix VS Code Docker Extension Showing Empty Container List

You open the Docker extension in VS Code, but the containers, images, and networks panels are all empty. Docker is running on your system, and docker ps in the terminal shows containers, but VS Code displays nothing.

Step 1: Verify Docker Is Running

Check Docker from the command line:

bash
docker ps
docker info

If docker info shows an error, the Docker daemon is not running:

```bash # Linux sudo systemctl status docker sudo systemctl start docker

# macOS (Docker Desktop) # Check the menu bar icon open -a Docker

# Windows # Check Docker Desktop in system tray ```

Step 2: Docker Extension Requires Docker CLI

The VS Code Docker extension uses the Docker CLI to communicate with the Docker daemon. Verify the CLI is accessible:

bash
which docker
docker --version

If Docker is installed but not in the PATH, configure the extension:

json
{
    "docker.environment": {
        "DOCKER_HOST": "unix:///var/run/docker.sock"
    }
}

Step 3: Docker Socket Permissions (Linux)

On Linux, the Docker socket may not be readable by your user:

bash
ls -la /var/run/docker.sock
# srw-rw---- 1 root docker 0 Apr  8 10:00 /var/run/docker.sock

If you are not in the docker group:

bash
sudo usermod -aG docker $USER
newgrp docker

Then restart VS Code. The extension needs read/write access to the Docker socket to list containers.

Step 4: Docker Context Issue

Docker contexts can redirect the Docker CLI to a different daemon. Check the current context:

bash
docker context ls
docker context show

If the context points to a remote or non-existent Docker host, VS Code will show an empty list:

bash
# Reset to default context
docker context use default

Step 5: Docker Extension Not Connected to Correct Host

The Docker extension may be looking at a different Docker host than your CLI. Check the Docker extension settings:

json
{
    "docker.host": "unix:///var/run/docker.sock"
}

For remote Docker hosts:

json
{
    "docker.host": "tcp://remote-docker:2375"
}

Step 6: Reload Docker Extension

Sometimes the extension loses its connection to the Docker daemon. Refresh the view:

bash
Docker: Refresh

From the Command Palette. Or reload the entire window:

bash
Developer: Reload Window

Step 7: Docker Extension Output

Check the Docker extension output for errors:

bash
View > Output > Select "Docker" from dropdown

This shows the exact Docker commands the extension runs and their output. Look for:

bash
Running docker ps --format ...
Error: Cannot connect to the Docker daemon...

Step 8: Docker Desktop API Issues (macOS/Windows)

On macOS and Windows with Docker Desktop, the extension uses the Docker Desktop API in addition to the CLI. If Docker Desktop is running but the API is unresponsive:

  1. 1.Quit Docker Desktop completely
  2. 2.Restart Docker Desktop
  3. 3.Wait for the whale icon to stop animating
  4. 4.Restart VS Code

Step 9: Conflicting Docker Extensions

Multiple Docker-related extensions can conflict. Check for:

  • Docker (official by Microsoft)
  • Docker Explorer
  • Remote - Containers / Dev Containers

Keep only the official Docker extension and the Dev Containers extension. Disable any third-party Docker extensions.

Step 10: Dev Containers Integration

If you use Dev Containers, ensure the Docker extension can see Dev Container volumes:

json
{
    "dev.containers.dockerSocketPath": "/var/run/docker.sock"
}

Dev Containers creates its own Docker containers for development environments. The Docker extension should show these containers in the list alongside regular containers.

Alternative: Use Docker CLI in Integrated Terminal

If the Docker extension continues to fail, you can always use the integrated terminal:

bash
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
docker logs -f container_name
docker exec -it container_name bash

The CLI is always the most reliable way to interact with Docker, even when the VS Code extension has issues.