The project is an implementation of additional layer store plugin of CRI-O/Podman, it provides CRI-O/Podman with the ability to lazy mount nydus images.
- Build store plugin
$ git clone [email protected]:fatelei/crio-nydus-store-plugin.git
$ cd crio-nydus-store-plugin
$ go build cmd/store/main.go
- Install nydusd
Download nydus binaries from nydus release page, and then install with the command below:
$ tar xzvf nydus-static-$version-linux-amd64.tgz
$ sudo mv nydus-static/nydusd-fusedev /usr/bin/nydusd
$ sudo mv nydus-static/nydusify /usr/bin/nydusify
$ sudo mv nydus-static/nydus-image /usr/bin/nydus-image
- Configure podman
Get an /etc/containers/storage.conf
example from here, and add with [storage.options]
section like:
[storage.options]
additionallayerstores = [
"/var/lib/nydus-store/store:ref"
]
Make sure you have created the directory with mkdir -p /var/lib/nydus-store/store
.
- Run store plugin
Prepare a nydus configuration JSON file like below, named as /etc/nydusd-config.json
:
{
"device": {
"backend": {
"type": "registry",
"config": {
"scheme": "http",
"timeout": 5,
"connect_timeout": 5,
"retry_limit": 2
}
},
"cache": {
"type": "blobcache",
"config": {
"work_dir": "/var/lib/nydus/cache"
}
}
},
"mode": "direct",
"digest_validate": false,
"iostats_files": false,
"enable_xattr": true,
"fs_prefetch": {
"enable": true,
"threads_count": 2
}
}
$ sudo ./store --log-to-stdout --log-level debug --config-path /etc/nydusd-config.json --root /var/lib/nydus-store
- Convert a nydus image
# Prepare a local registry
$ podman run -d -it -p 5000:5000 --name registry docker.io/library/registry:2
# Convert OCI v1 image to nydus image:
$ sudo nydusify convert --source ubuntu --target localhost:5000/ubuntu:latest-nydus
- Run container with nydus image
$ sudo podman run -it --tls-verify=false --rm localhost:5000/ubuntu:latest-nydus /bin/bash