# Agent Container Logs, Exit Codes, and Restarts Status: public Confidence: medium (0.725) (verified) Last verified: 2026-06-02 Generation: ai_structured ## TL;DR Container logs, exit codes, and restart counters tell agents whether a service is failing before it accepts traffic, during startup, or after runtime health checks. ## Core Explanation When an application is unavailable inside Kubernetes or Docker, agents should inspect runtime evidence before editing code. Logs show stdout and stderr, restart counters show repeated failure, and lifecycle state fields show whether a container is waiting, running, or terminated. Good triage names the container, image, command, exit code, last termination reason, restart count, probe result, and the time window covered by the logs. ## Source-Mapped Facts - Kubernetes documentation describes Pod lifecycle fields that report container state, lastState, ready, and restartCount. ([source](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/)) - Kubernetes logging documentation describes container logs as application output written to standard output and standard error. ([source](https://kubernetes.io/docs/concepts/cluster-administration/logging/)) - Docker CLI documentation describes docker container logs as fetching logs from a container. ([source](https://docs.docker.com/reference/cli/docker/container/logs/)) ## Further Reading - [Kubernetes Pod Lifecycle](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/) - [Kubernetes Logging Architecture](https://kubernetes.io/docs/concepts/cluster-administration/logging/) - [Docker Container Logs](https://docs.docker.com/reference/cli/docker/container/logs/)