container/storage是container/image的基础,和containerd snapshotter接口功能类似,但是是两套接口。
storage用于管理layer、image、container。
layer对应的就是overlayfs的一层,image对应的就是一个镜像,container对应的就是基于image+读写layer的容器rootfs。
https://github.com/containers/podman/issues/4739 支持additional layer store(ALS),需要配置addition layer store或者通过以下脚本
假设配置为:
layerstore=
查找方式:
<ALS root>/base64("key1=value1")/base64("key2=value2")/.../base64("keyX=valueX")/
`-- diff 是个目录,包含这一层的different
`-- info 是文件,包含 "*c/storage.Layer" struct
If the layer content is found in ALS, c/storage.Store creates layer using
podman --storage-opt "layerstore=/tmp/storage:reference:layerdigest" pull ghcr.io/stargz-containers/rethinkdb:2.3.6-esgz
podman --storage-opt "layerstore=/tmp/storage:reference:layerdigest" run --rm -it ghcr.io/stargz-containers/rethinkdb:2.3.6-esgz /bin/echo 'Hello, World!'
- stargz-store是mount在“/tmp/storage”
- storage.store会通过ALS(additional layer store)查找 /tmp/storage/base64(“reference=ghcr.io/stargz-containers/rethinkdb:2.3.6-esgz”)/base64(
)/{diff, info} - 然后 stargz-store会去拉取需要的信息。
stargz-store 作为单独进程启动,在读取文件stargz会通过stargz lazy拉取:
stargz-store
<mountpoint>/base64(imageref)/<layerdigest>/
- diff : exposes the extracted layer
- info : contains JSON-formatted "Layer" structure of containers/storage
- use : files to notify the use of this layer (used for management of reference count)