Back to commands

Linux Survival Basics

Read-only

Inspect Docker Restart Policy

You need restart policy, exit code, and current state error for one container.

Command

docker inspect -f '{{.HostConfig.RestartPolicy.Name}} {{.State.ExitCode}} {{.State.Error}}' container_name

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not disable restart policies before proving the application failure.

Expected output

Restart policy name, exit code, and state error text.

System impact

Read-only. Nothing changes. The command reads current state and prints diagnostic evidence.

Recovery / rollback: no state is changed.

When to use it

Use when restart behavior is unclear.

When not to use it

Do not disable restart policies before proving the application failure.

Common misread

Do not disable restart policies before proving the application failure.

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 inspect -f '{{.HostConfig.RestartPolicy.Name}} {{.State.ExitCode}} {{.State.Error}}' container_name
  2. docker inspect -f '{{.HostConfig.RestartPolicy.Name}} {{.State.ExitCode}} {{.State.Error}}' container_name

next steps

Related commands

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
Linux Survival Basics Can be slow

List Docker Container Restart Status

Restart loops are visible before rebuilding anything.

docker ps -a --format 'table {{.Names}} {{.Image}} {{.Status}} {{.RestartCount}}'
Linux Survival Basics Read-only

Spot Foreign-Architecture Packages

One unexpected architecture can explain confusing dependency output.

dpkg-query -W -f='${Architecture}\t${Package}\n' | awk '$1 != "amd64" && $1 != "all"'

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.