# 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:
docker ps
docker infoIf 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:
which docker
docker --versionIf Docker is installed but not in the PATH, configure the extension:
{
"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:
ls -la /var/run/docker.sock
# srw-rw---- 1 root docker 0 Apr 8 10:00 /var/run/docker.sockIf you are not in the docker group:
sudo usermod -aG docker $USER
newgrp dockerThen 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:
docker context ls
docker context showIf the context points to a remote or non-existent Docker host, VS Code will show an empty list:
# Reset to default context
docker context use defaultStep 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:
{
"docker.host": "unix:///var/run/docker.sock"
}For remote Docker hosts:
{
"docker.host": "tcp://remote-docker:2375"
}Step 6: Reload Docker Extension
Sometimes the extension loses its connection to the Docker daemon. Refresh the view:
Docker: RefreshFrom the Command Palette. Or reload the entire window:
Developer: Reload WindowStep 7: Docker Extension Output
Check the Docker extension output for errors:
View > Output > Select "Docker" from dropdownThis shows the exact Docker commands the extension runs and their output. Look for:
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.Quit Docker Desktop completely
- 2.Restart Docker Desktop
- 3.Wait for the whale icon to stop animating
- 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:
{
"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:
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
docker logs -f container_name
docker exec -it container_name bashThe CLI is always the most reliable way to interact with Docker, even when the VS Code extension has issues.