第39节 Update containers vendor 更新容器供应商
❤️💕💕记录sealos开源项目的学习过程。k8s,docker和云原生的学习。Myblog:http://nsddd.top
[TOC]
Issue Description
https://github.com/containers/common/issues/1376
https://github.com/sealerio/sealer/issues/2147
[ ] support set load tmp dir for save and load, we could set
tmp-dir
flag tosysContext.BigFilesTemporaryDir
.[ ] Waiting for a separate functions Or string flag from containers SDK, which will not guess what type of input tar file. this is more time-saving.
more to see : containers/common#1376
Describe what feature you want
for 1 , we could use --tmp-dir
flag to do it.
sealer load -i my.tar --tmp-dir /root/my-tmp
sealer save abc:v1 -o my.tar --tmp-dir /root/my-tmp
- load: load a sealer image from a tar file: Load the sealer image from the tar file
- save: save sealer image to a tar file : Save Save the sealer image as a tar file
related go mod version:
go get github.com/containers/buildah@v1.29.1
go get github.com/containers/common@v0.51.0
go get github.com/containers/image/v5@v5.24.1
go get github.com/containers/ocicrypt@v1.1.7
go get github.com/containers/storage@v1.45.3
[optimize] add a new parameter to LoadOptions
I found that If i knew the format of the tar file in advance , the program wouldn't need to guess the format, which will save a lot of time.
so , should we add a new parameter to indicate the format of load package on LoadOptions
?
- https://github.com/containers/common/blob/28ebcc64cf9af714badd8abd5521ed49545642c0/libimage/load.go#L33
// we have 4 functions, so a maximum of 4 errors
loadErrors := make([]error, 0, 4)
for _, f := range []func() ([]string, string, error){
That sounds like a nice improvement assuming the user knows exactly the format of the archive.
If this is for a new caller, I think a set of separate functions (Runtime.LoadDockerArchive
etc.) would be simpler.
If this is for the primary podman load $path
code path, yes, an option probably makes sense — and it would be great to update as many callers as possible to use that option; heuristically guessing among four possibly quite expensive readers is very inefficient and historically resulted in bad error messages (which we have, sort of, fixed by just listing all of the error messages…)
Set up temporary directory
the reason is that some image is very large, and require at least three times free disk to load. I see that current default temporary directory is the /var/tmp/
directory. If we could set the work temporary directory, we can separate it from the system disk which will avoid load failure.
That’s configurable in c/image via BigFilesTemporaryDir
, and c/common/libimage seems to read containers.conf
for that at least in some places, so that would be the setting to tweak. (I didn’t check if LoadDockerArchive
applies this setting; if not, that should be added.)
Yes setting this in containers.conf, or setting the TMPDIR environment variable allow you to customize this.
计划
For sealer :
sealer save abc:v1 -o my.tar --tmp-dir /root/my-tmp
[x] add a flag
// TODO: Waiting for implementation, not yet supported flags.StringVar(&loadOpts.TmpDir, "tmp-dir", "", "Set temporary directory when load image. if not set, use system temporary directory(`/var/tmp/`)")
[ ] come true
MultiImageArchive
// MultiImageArchive - if true, the container engine allows for storing // archives (e.g., of the docker-archive transport) with multiple // images. By default, Podman creates single-image archives. MultiImageArchive bool `toml:"multi_image_archive,omitempty"`
[ ] update pack
[ ] Temporary load directory primitives, garbage collection
END 链接
✴️版权声明 © :本书所有内容遵循CC-BY-SA 3.0协议(署名-相同方式共享)©