Hands-on task
Isolation of your own in one command
Before a release the report export script is run "in quarantine". It picks its config by hostname, so it needs the name report-sandbox, and it must have no network: if the code still calls an external API, in quarantine the script fails instead of sending the data out. So two kinds of isolation are needed at once. You don't need Docker for that — the kernel gives the same isolation to any command.
Start a long-lived process (sleep infinity will do) in two new namespaces at once:
- UTS — with its own hostname
report-sandbox; - net — with its own empty network: no interface up except
lo, and not a single route.
Leave the process running, and the server's own hostname must stay the same. Once it's running, compare the process's /proc/<PID>/ns/ with your shell's: which numbers differ and which are still shared.
- namespaces
- unshare
- nsenter
- /proc