mkcomposefs(1)(composefs)
π mkcomposefs β composefs manual, section 1 β¨
okay so bestie, gather round, because we're talking about mkcomposefs from the composefs project and honestly? it's giving main character energy in the container world. this is the section 1 manual page, so it's a command, and it's a whole vibe. let's go π
πΈ NAME πΈ
mkcomposefs β create a composefs filesystem image β¨
π SYNOPSIS π
mkcomposefs SOURCE IMAGE
like that's literally it, two little args, so simple, so clean π«Ά
π¦ DESCRIPTION π¦
so here's the lore: the composefs project uses an EROFS image file to store metadata, plus one or more separate directories holding content-addressed backing data for regular files. two things, working together, iconic honestly.
mkcomposefs constructs the mountable "composefs image" using the source as input. it can also create the backing store directory. typically the source is a directory, but with --from-file it can also be a file. versatile queen π
β¨ OPTIONS β¨
okay so first, the ground rules:
the provided SOURCEDIR argument must be a directory, and its entire contents will be read recursively (all of it, no skipping, we're thorough π). the provided IMAGE argument will be a mountable composefs image.
and mkcomposefs accepts the following options:
--digest-store=PATHβ this path will become a composefs "object store". regular files larger than 64 bytes in theSOURCEDIRwill be copied (reflinked if possible, bestie we love a reflink) into this target directory, named after their fsverity digest. small files get inlined into the image metadata instead. if possible, the added files will have fs-verity enabled. you should pass this directory to thebasediroption when you mount the image. iykyk π--print-digestβ print the fsverity digest of the composefs metadata file π--print-digest-onlyβ print the fsverity digest of the composefs metadata file, but don't write the image. if this is passed, theIMAGEargument should be left out. no image, just vibes and a digest β¨--use-epochβ use a zero time (unix epoch) as the modification time for all files. time is fake, set it to zero π°οΈ--skip-devicesβ don't add device nodes to the image π«--skip-xattrsβ don't add xattrs to files in the image π«--user-xattrsβ only add xattrs with the"user."prefix to files in the image. picky but valid π--from-fileβ the source is a file in thecomposefs-dump(5)format. if the specified file is"-", the data is read from stdin. pipe it in, queen π--versionβ the base version to use for the image format--max-versionβ if this specifies a version higher than--version, then the actual image format version used will be adjusted upwards if that is beneficial for the image, up to the max version. so like, it can level up but only if it's worth it π--threads=countβ number of threads to be used to calculate the file digests and copy. default thread count is the number of processors when--threadsis not specified. go parallel or go home π₯
π§ FORMAT VERSIONING π§
composefs images are binary reproduceable, meaning that for a given input the result is always the same, giving the same digest of the image. this is important because the digest is used to validate the image β even if the image was re-created rather than transferred as-is. fr fr, the digest is the whole point.
but sometimes the format needs to change, like when a new type of file is introduced or a bug gets fixed. that's handled by introducing a format version.
specifying the version happens with two options: the base version (--version) and the max version (--max-version). when building an image, mkcomposefs tries to keep the image format as low as possible, but if some particular requested feature isn't available with the base feature, and it is accessible in the max version, then the version used will be increased. this lets them introduce new features and fix bugs in a later version and migrate to that using max versions, while still keeping the digests identical for unaffected images. no cap π«Ά
if you need 100% binary reproducibility over time, specify the same version and a max version each time.
format version history:
- 0 β initial version
- 1 β supports overlay whiteout files in the image (added in 1.0.3)
the default if no version arguments are specified is version 0 and max version 1.
π‘οΈ SANDBOXING RECOMMENDATIONS π‘οΈ
this tool essentially just processes an input directory or text file and writes a file. it does not require any privileges at all. literally zero. so if you're invoking this as part of an otherwise privileged process (like, say, a container runtime), we recommend dropping privileges before invoking mkcomposefs. stay safe bestie π
especially if you're using --from-file, you can run this as an unprivileged uid that has no writable filesystem access at all except to a passed file descriptor. for example, you can pass a writable file descriptor for the desired target file as fd 3, and run:
mkcomposefs --from-file - /proc/self/fd/3
to effectively use mkcomposefs as part of a pipeline. so clever, so iconic β¨
an example simple sandboxing starting from root is:
setpriv --nnp --reuid nobody -- mkcomposefs ....
another is to use:
systemd-run -P DynamicUser=yes -P ProtectSystem=strict
yet another (especially if your code is already part of a container runtime) is to use that runtime's existing functionality (seccomp, unsharing user namespace, mounting a restricted subset of the rootfs, etc. β yes the original sentence just ends there, no closing paren, and honestly? we respect it π).
π SEE ALSO π
composefs upstream β¨https://github.com/containers/composefsβ© π
and that's the whole page bestie, every flag, every version, every sandboxing tip, all of it, preserved and slaying π
okay so final sign-off moment: this page lives under the composefs manual, in the User commands corner, and it's mkcomposefs(1)(composefs) β that's the title, the section, and the family all in one, periodt. go make some images, ily π«Άβ¨π
π¦ where this page comes from
- arch rolling: composefs 1.0.8-1 Β· LGPL-2.1-or-later AND BSD-2-Clause OR GPL-2.0-or-later AND GPL-2.0-only OR Apache-2.0 AND GPL-3.0-or-later
- fedora 43: composefs 1.0.8-3.fc43 Β· LGPL-2.0-or-later AND Apache-2.0
- fedora 43: composefs 1.0.8-3.fc43 Β· LGPL-2.0-or-later AND Apache-2.0
- fedora 44: composefs 1.0.8-5.fc44 Β· LGPL-2.0-or-later AND Apache-2.0
- fedora 44: composefs 1.0.8-5.fc44 Β· LGPL-2.0-or-later AND Apache-2.0
- nixos 26.05: composefs 1.0.8
- nixpkgs unstable: composefs 1.0.8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms