An opinionated way to manage systemd-nspawn containers without relying on BTRFS. Works in tandem with machinectl and systemctl.
https://github.com/wagoodman/boxctl.git
Note: this is a work in progress, so it is not stable yet.
# assume a container filesystem is provided in the given tar file, stage this
# "image" (called 'foo-0.1') for future use.
boxctl stage-image <path-to-'foo-0.1.tar'>
# Create a new container named "system1" that uses the 'foo-0.1' image
boxctl cutover-instance system1 foo-0.1
<by this point the container has been started and is now running>
# Stop the container
boxctl poweroff system1
# Start the container
boxctl start system1
# Stage a new version of the container software
boxctl stage-image <path-to-'foo-0.2.tar'>
# Stop the running system1 container, cutover to the new image, and start the
# container with a new instance of the foo-0.2 image
boxctl cutover-instance system1 foo-0.2
<by this point the container has been started and is now running with the foo-0.2 image>
# Something is wrong and you've determined that you need to fallback to the previous
# version of the container filesystem (foo-0.1), with all changes from before the
# last cutover.
boxctl fallback-instance system1
<by this point the container has been restarted and is now running with the original foo-0.1 image instance>
boxctl - wrapper for systemd-nspawn system container management
boxctl <command> <instance-name> [<image-name>]
Container commands:
configure <name> Enter the container without booting it (for making filesystem changes).
disable <name> Ensure the system container does *not* start upon reboot of the host.
enable <name> Ensure the system container starts upon reboot of the host.
list <name> Show all running system containers.
login <name> Enter a TTY session to the system container.
poweroff <name> Shutdown the system container.
restart <name> Power off then power on the system container.
start <name> Power on the system container.
status <name> Determine the operational condition of the system container.
terminate <name> Forcefully kill the system container (not recommended).
Container image/instance commands:
cutover-instance <name> <image-name> Actively cutover to a new container instance.
delete-instance <name> <image-name> Delete the instance based off of the given image name.
fallback-instance <name> Fallback to a previously used instance.
list-images Show avaliable images, current instance, and fallback instance.
reset <name> <image-name> Reset the current instance to the originally installed image.
stage-image <tar-path> Install a new image from the given tar.gz archive.