Logs, inspect & lifecycle

Read logs before restarting

Lesson 3 of 20 · 12 min · Module 1: Containers and access

Gather evidence before replacing the thing you are trying to diagnose.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Collect application evidence
  • Inspect the configuration

The idea

Container operations change instances and their attached configuration. Inspect the resulting state as well as the command sequence.

01Collect application evidence

docker logs reads output recorded by the container process. In this model it includes a sample listening message and a health request. A restart alone does not explain a failure.

02Inspect the configuration

docker inspect gives metadata such as image, ports, and mounts. Use it to check whether the process was configured the way you expected.

03Distinguish stop from removal

stop changes the lifecycle state. rm removes the container record after it has stopped. Keeping it briefly can preserve useful diagnostic evidence.

Your turn

Start notes:1.0 as api, read its logs, inspect it, and stop it. Keep the stopped container so its metadata remains available.

What the checks look for

  • Reads logs and configuration
  • Stops without removing the container
Try it in the editor →

Take this with you

Observe, form a hypothesis, and then change the system.

Go a little further

Start the stopped container again and compare its image and name.

Learn Docker & Containers for free

20 short lessons with real code and instant checks.

See the whole course →