I made a Dockerfile-like system for rootfs (root filesystem) images #4740
kanpov
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
One of my pain points with Firecracker was the error-prone setup that is recommended for creating rootfs images, also known as putting together a bunch of Bash scripts. In my opinion, this is far inferior to just having a
Dockerfile/Containerfilethat produces the image (in this case, not an OCI image, but rather a rootfs), so I wrote a CLI tool that uses a easy-to-understand and easy-to-write TOML build script to produce a rootfs in Rust: https://crates.io/crates/buildfs.In the README available on crates.io there is a complete getting started guide with a single TOML build script that can be executed to produce a minified systemd rootfs based on
debian:bookworm-slim.buildfsalso supports overlays, i.e. injecting files and directories into the rootfs ("overlaying" them) in separate files that are referenced with the TOML script and packaged together into a directory/tarball (if no such references exist, we can use only the TOML script as shown in the getting started guide), and running not only inline, but also external scripts also packaged together with the TOML.The steps that
buildfsuses to produce the rootfs are:dd,mkfsis run and the filesystem is mounted into a temporary location/sbinand an example of the latter would be/devor/procas these are just empty mountpoints)By streamlining as much of the rootfs creation process as possible,
buildfsallows you to configure only the things that matter and automate away the rest (as shown above): scripts to run and overlays to apply, which container image to use, which type of filesystem to create and how big it should be, which directories and files to save and which mountpoints to create. The example build script from the README is only 55 lines of TOML and it is enough to create an EXT4 Debian rootfs with systemd and DNS configured that is ready for use in Firecracker.Beta Was this translation helpful? Give feedback.
All reactions