CertGrid CertGrid
Hands-on Lab·CompTIA Linux+

Bash, Git, and rootless containers in one workflow

Domain 4 is 17% of XK0-006 and over half of it is shell scripting. This guide writes a script that reports success after failing, fixes it with three settings, gives it arguments and an exit code a scheduler can act on, puts it under git, and runs it inside a rootless container - which is the rest of the domain.

Automation and Scripting Guide 8 of 28 Intermediate

One host. Everything on this page is scripting, git and a rootless container, none of which needs a second machine.
Server NameIP AddressOSRolesCPURAMHDD
LPLUS-A01192.168.0.73Ubuntu 26.04 LTSDebian-family host - apt, ufw, netplan, AppArmor2 Core4 GB50 GB

This guide includes

Use this before you schedule anything you wrote. This matters because a script without set -euo pipefail carries on after a command fails and exits zero, so the thing that runs it every night will report success for as long as it keeps failing.

Before you start

  1. A script that hides its own failure

  2. The three settings that make it honest

  3. Arguments, defaults, and an exit code that means something

  4. Under version control, which is a Domain 4 objective

  5. The same script inside a rootless container

  6. Putting the machine back

Official sources