Skip to content
Ameen Abozaid
Planned lessonJNR-049-L06

Debugging containers

  • Lesson 6 of 8
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

find out why a container misbehaves.

Planned topics

  • docker logs -f NAME shows the output of the app.
  • docker exec -it NAME sh opens a shell inside a running container.
  • docker inspect NAME shows environment, mounts, network, and exit code.
  • docker ps -a shows stopped containers; check their exit code (137 often means killed, for example out of memory).
  • Check the simple things first: wrong port, wrong env var, wrong hostname.
Draft outline details

Demonstration

docker logs shop, docker exec -it shop sh, docker inspect shop --format '{{.State.ExitCode}}'.

Check your understanding

Which command opens a shell in a running container?

Show answer

docker exec -it NAME sh.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.