Container Debugging

aj-geddes/useful-ai-prompts/skills/container-debugging

作者 aj-geddes3f5182cfd739無授權條款355 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Debug Docker containers and containerized applications. Diagnose deployment issues, container lifecycle problems, and resource constraints.

包含腳本DevOps & Cloud
AI 產生的概覽

診斷 Docker 與容器化應用程式問題,例如啟動失敗、崩潰、資源限制和網路異常。

功能
提供偵錯 Docker 容器與容器化應用程式的結構化流程,涵蓋容器狀態檢查、日誌檢視、exec 工作階段、資源用量與設定審查。隨附 Docker 偵錯基礎、常見容器問題、容器最佳化與偵錯檢查清單等參考指南,以及設定驗證指令碼和起始設定範本。產出為診斷建議與經驗證的設定,而非應用程式程式碼。
適用情境
適用於容器無法啟動、應用程式在容器內崩潰、超出資源限制,或容器出現網路與效能問題時。也適合在部署前後審查容器設定。
執行需求
需要 Docker 工具鏈及容器執行環境的存取權限,以執行 docker ps、logs、exec、inspect、stats 等指令。隨附可執行驗證指令碼與 YAML 設定範本。

Container Debugging

Table of Contents

Overview

Container debugging focuses on issues within Docker/Kubernetes environments including resource constraints, networking, and application runtime problems.

When to Use

  • Container won't start
  • Application crashes in container
  • Resource limits exceeded
  • Network connectivity issues
  • Performance problems in containers

Quick Start

Minimal working example:

bash
# Check container statusdocker ps -adocker inspect <container-id>docker stats <container-id>
# View container logsdocker logs <container-id>docker logs --follow <container-id>  # Real-timedocker logs --tail 100 <container-id>  # Last 100 lines
# Connect to running containerdocker exec -it <container-id> /bin/bashdocker exec -it <container-id> sh
# Inspect container detailsdocker inspect <container-id> | grep -A 5 "State"docker inspect <container-id> | grep -E "Memory|Cpu"
# Check container processesdocker top <container-id>
# View resource usagedocker stats <container-id># Shows: CPU%, Memory usage, Network I/O
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Docker Debugging Basics [blocked]Docker Debugging Basics
Common Container Issues [blocked]Common Container Issues
Container Optimization [blocked]Container Optimization
Debugging Checklist [blocked]Debugging Checklist

Best Practices

✅ DO

  • Follow established patterns and conventions
  • Write clean, maintainable code
  • Add appropriate documentation
  • Test thoroughly before deploying

❌ DON'T

  • Skip testing or validation
  • Ignore error handling
  • Hard-code configuration values

來源與署名

來源:aj-geddes/useful-ai-prompts位於skills/container-debugging提交3f5182c

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架