Back to commands

Linux Survival Basics

Read-only, can be slow

List Docker Container Restart Status

You need names, images, status, and restart counts for containers.

Command

docker ps -a --format 'table {{.Names}}	{{.Image}}	{{.Status}}	{{.RestartCount}}'

Before you run this

System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.

When not to use it: Do not delete containers or volumes from this output alone.

Expected output

A table of container names, images, status strings, and restart counts.

System impact

Read-only, can be slow. Nothing changes. The command reads current state and prints diagnostic evidence.

Scope this to the smallest useful path or service on busy systems.

Recovery / rollback: no state is changed.

When to use it

Use when a container keeps restarting or disappears from the healthy list.

When not to use it

Do not delete containers or volumes from this output alone.

Common misread

Do not delete containers or volumes from this output alone.

Example run

Commands shown

These are the commands shown for inspection. Treat them as an example, not proof that your system will behave identically.

  1. docker ps -a --format 'table {{.Names}} {{.Image}} {{.Status}} {{.RestartCount}}'
  2. docker ps -a --format 'table {{.Names}} {{.Image}} {{.Status}} {{.RestartCount}}'

next steps

Related commands

Hosting Operations Can be slow

Show Containers in a Clean Triage Table

Turn noisy docker ps output into the few fields operators scan first.

docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}\t{{.Ports}}'
Web Server Rescue Can be slow

Find Restarting Containers Fast

Restart loops hide in plain sight unless you filter for them.

docker ps -a --filter status=restarting --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}'
Linux Survival Basics Read-only

Inspect Docker Restart Policy

Policy and exit code explain whether Docker is restarting by design.

docker inspect -f '{{.HostConfig.RestartPolicy.Name}} {{.State.ExitCode}} {{.State.Error}}' container_name
Linux Survival Basics Can be slow

Read Recent Docker Container Logs

Recent container logs usually show the failing command or dependency.

docker logs --tail 80 container_name

next diagnostic step

Where to go from this command

Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.