What you will build
Step 1: Create the root filesystem skeleton
A container root needs a few directories. Create them under rootfs and give the box a hostname file:
mkdir -p rootfs/bin rootfs/proc rootfs/etc
echo mini > rootfs/etc/hostnameRun ls -R rootfs to confirm the directories exist.
Step 2: Write the launcher script
Write run-box.sh. It asks for new namespaces with unshare and then runs a shell inside rootfs with chroot. Running it is optional here, because an unprivileged user usually gets a permission error:
cat > run-box.sh <<'EOF'
#!/bin/bash
set -eu
unshare --uts --mount --fork chroot /workspace/rootfs /bin/sh
EOFThe file must mention both unshare and chroot. Keep the script readable, one command per line.
Step 3: Check the script without running it
bash -n reads a script and reports syntax errors without running any command. Run it and save a note when it passes:
bash -n run-box.sh && echo "syntax ok" > syntax.txtOpen syntax.txt. It should say syntax ok.
Files
walkthrough.sh: every step of the reference solution, in order.
How it is checked
Each step in the guided lab has a check script that runs on the lab machine after you finish. It passes only when the files and output it expects are there, so the lab cannot be completed by reading alone.