Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 13 · From Scratch · Container Runtime · with code: Go · about 11 min to read

Play it as a journeyTutor comes with a plan

Container 03: A Mount Namespace and pivot_root

The Shipping Container
The Shipping Container · Open board

The sealed box and what is packed inside it. This stage builds the packing: a folder of Alpine Linux that the program is told is the whole world.

Before you start. Container 02: UTS and PID Namespaces gave the box its own hostname and its own process numbers. This stage gives it its own files. A file system here means the tree of folders that starts at /, called the root. A mount is one file system attached at one place in that tree, and the list of all mounts is what mount prints. If mounts are new, Linux and the Shell: Processes, Files, Pipes, Permissions and Signals covers the shell side. The idea is that a disk, a USB stick and a network share are each attached (“mounted”) at some folder. You also need the Alpine folder from Build Your Own Container Runtime, unpacked at /tmp/rootfs.

Lesson 97 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The manual page that says chroot is not for this
  • First, a private list of mounts
  • pivot_root, step by step
  • The environment is a wall too
  • What is still missing

Terms it explains: file system, root, mount, swaps, mount namespace, bind mount, `pivotRoot`, `child`, `run.go`, The tests, Changes to try, image.

Related paper

Review From Scratch