mirror of
https://github.com/containerd/containerd.git
synced 2026-08-13 17:07:26 +00:00
Enabling the IMMUTABLE_FL file attribute causes dirty data to be flushed synchronously at least on EXT4, which can greatly impact container launch performance. In contrast, the overlayfs snapshotter does not use syncfs by default. Most users may not need IMMUTABLE_FL, let's make IMMUTABLE_FL optional to align with the behavior of the overlayfs snapshotter and recover the original performance. 1. tensorflow Test commands: $ nerdctl image pull --snapshotter=X --unpack="false" tensorflow/tensorflow:2.19.0 $ time nerdctl container --snapshotter=X run -d tensorflow/tensorflow:2.19.0 /bin/sh Results: overlayfs | 0m18.748s erofs (no IMMUTABLE_FL) | 0m10.090s erofs (with IMMUTABLE_FL) | 0m21.074s 2. ubuntu 22.04 Test commands: $ nerdctl image pull --snapshotter=X --unpack="false" ubuntu:22.04 $ time nerdctl container --snapshotter=X run -d ubuntu:22.04 /bin/sh Results: overlayfs | 0m1.147s erofs (no IMMUTABLE_FL) | 0m0.795s erofs (with IMMUTABLE_FL) | 0m1.094s Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Snapshotters
Snapshotters manage the snapshots of the container filesystems.
The available snapshotters can be inspected by running ctr plugins ls or nerdctl info.
Core snapshotter plugins
Generic:
overlayfs(default): OverlayFS. This driver is akin to Docker/Moby's "overlay2" storage driver, but containerd's implementation is not called "overlay2".native: Native file copying driver. Akin to Docker/Moby's "vfs" driver.
Block-based:
blockfile: A driver using raw block files for each snapshot. Block files are copied from a parent or base empty block file. Mounting requires a virtual machine or support for loopback mounts.devmapper: ext4/xfs device mapper. Seedevmapper.md.
Filesystem-specific:
btrfs: btrfs. Needs the plugin root (/var/lib/containerd/io.containerd.snapshotter.v1.btrfs) to be mounted as btrfs.zfs: ZFS. Needs the plugin root (/var/lib/containerd/io.containerd.snapshotter.v1.zfs) to be mounted as ZFS. See also https://github.com/containerd/zfs .erofs: EROFS.OverlayFSkernel module needs to be enabled for active snapshots. See alsoerofs.md.
aufs: AUFS. Deprecated since containerd 1.5. Removed in containerd 2.0. See also https://github.com/containerd/aufs .
Non-core snapshotter plugins
fuse-overlayfs: FUSE-OverlayFS Snapshotternydus: Nydus Snapshotteroverlaybd: OverlayBD Snapshotterstargz: Stargz Snapshotter
Mount target
Mounts can optionally specify a target to describe submounts in the container's rootfs. For example, if the snapshotter wishes to bind mount to a subdirectory ontop of an overlayfs mount, they can return the following mounts:
[
{
"type": "overlay",
"source": "overlay",
"options": [
"workdir=...",
"upperdir=...",
"lowerdir=..."
]
},
{
"type": "bind",
"source": "/path/on/host",
"target": "/path/inside/container",
"options": [
"ro",
"rbind"
]
}
]
However, the mountpoint /path/inside/container needs to exist for the bind
mount, so one of the previous mounts must be responsible for providing that
directory in the rootfs. In this case, one of the lower dirs of the overlay has
that directory to enable the bind mount.