claude-home/reference/docker/troubleshooting.md
Cal Corum 2bfbc7bb77 CLAUDE: Initialize efficient documentation system for home lab
- Created structured documentation with /patterns/, /examples/, and /reference/ directories
- Implemented automatic context loading rules in CLAUDE.md based on file extensions, directories, and keywords
- Added technology-specific patterns for Docker, Python, Node.js, Vue.js, Bash, networking, databases, and VM management
- Included complete working examples for common workflows and troubleshooting references
- Designed for minimal context usage with precise loading triggers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 19:59:29 -05:00

87 lines
1.7 KiB
Markdown

# 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
```