Instiq
Chapter 6 · Containers·v1.0.0·Updated 7/7/2026·~13 min

What's changed: Initial version (topic 2.06, subtopics 2.06.1–2.06.2)

6.2Managing Docker Containers and Images

Key points

Learn day-to-day Docker operations: port mapping and the flat L2 network, inspecting state with docker ps/docker stats, lifecycle management with docker run/create/restart, pause/unpause and stop/kill/rm, working inside containers with attach/exec, the Docker registry with docker images/pull/rmi/import, and building images via Dockerfile with docker build/docker commit.

The namespaces, cgroups, and image mechanics from the previous section become day-to-day work through the Docker tool. Being able to precisely choose commands to start, pause, stop, and remove containers, and to pull, build, and distribute images, matters both in practice and on the exam.

6.2.1Networking and inspecting state

  • Port mapping associates a container's internal port with a host port (e.g., docker run -p 8080:80, host:container). It lets multiple containers on a single host IP be exposed externally.
  • The flat L2 network model connects containers to the same virtual L2 network (a single subnet) through a bridge, letting them reach each other directly without routing—the default networking shape.
  • docker ps lists running containers (-a includes stopped ones too). docker stats shows live CPU, memory, and network I/O usage for running containers.

Continue reading — free sign-up

You're reading the free preview. Sign up free to read this section in full, plus every chapter (including 4+) and all questions.