All checks were successful
Reindex Knowledge Base / reindex (push) Successful in 3s
Adds title, description, type, domain, and tags frontmatter to every doc for improved KB semantic search. The description field is prepended to every search chunk, and domain/type/tags enable filtered queries. Type values: context, guide, runbook, reference, troubleshooting Domain values match directory structure (networking, docker, etc.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
2.1 KiB
Markdown
95 lines
2.1 KiB
Markdown
---
|
|
title: "Docker Quick Troubleshooting Reference"
|
|
description: "Concise quick-reference for common Docker troubleshooting commands covering container startup, build failures, performance monitoring, network debugging, and system cleanup."
|
|
type: troubleshooting
|
|
domain: docker
|
|
tags: [docker, troubleshooting, quick-reference, networking, builds, cleanup]
|
|
---
|
|
|
|
# Docker Troubleshooting Reference
|
|
|
|
## Container Won't Start
|
|
|
|
### Check logs
|
|
```bash
|
|
docker logs <container_name>
|
|
docker logs --tail 50 -f <container_name>
|
|
```
|
|
|
|
### Common issues
|
|
- **Port already in use**: `docker ps` to find conflicting containers
|
|
- **Permission errors**: Check file ownership and container user
|
|
- **Missing environment variables**: Verify with `docker exec -it <container> env`
|
|
- **Resource limits**: Check memory/CPU constraints
|
|
|
|
### Debug running container
|
|
```bash
|
|
docker exec -it <container> /bin/bash
|
|
docker exec -it <container> /bin/sh # if bash not available
|
|
```
|
|
|
|
## Build Issues
|
|
|
|
### Clear build cache
|
|
```bash
|
|
docker system prune -a
|
|
docker builder prune
|
|
```
|
|
|
|
### Build with verbose output
|
|
```bash
|
|
docker build --progress=plain --no-cache .
|
|
```
|
|
|
|
### Common build failures
|
|
- **COPY/ADD errors**: Check file paths and .dockerignore
|
|
- **Package installation**: Update package lists first
|
|
- **Network issues**: Check DNS and proxy settings
|
|
|
|
## Performance Issues
|
|
|
|
### Container resource usage
|
|
```bash
|
|
docker stats
|
|
docker exec <container> top
|
|
docker exec <container> free -h
|
|
```
|
|
|
|
### Image size optimization
|
|
```bash
|
|
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
|
|
docker history <image>
|
|
```
|
|
|
|
## Network Debugging
|
|
|
|
### List networks and connections
|
|
```bash
|
|
docker network ls
|
|
docker network inspect <network_name>
|
|
docker port <container>
|
|
```
|
|
|
|
### Test connectivity
|
|
```bash
|
|
docker exec <container> ping <target>
|
|
docker exec <container> nslookup <hostname>
|
|
docker exec <container> netstat -tulpn
|
|
```
|
|
|
|
## Quick Fixes
|
|
|
|
### Remove all stopped containers
|
|
```bash
|
|
docker container prune
|
|
```
|
|
|
|
### Remove unused images
|
|
```bash
|
|
docker image prune -a
|
|
```
|
|
|
|
### Reset Docker completely
|
|
```bash
|
|
docker system prune -a --volumes
|
|
``` |