In my previous blog about OCI artifacts, I outlined several new, experimental commands that had been added to Podman. Those commands (Linux only, remote is not supported currently) are now included in the Podman v5.4 release. If you run Podman on Linux, check them out and help us exercise the functionality.
We also had two new artifact-based features that were added to our main branch recently based on user feedback. The first was done by Jan Rodak where he added a flag to podman artifact add to append an artifact to an artifact already in the store.
Consider the following use case of a fictional artifact. Suppose I have a previously-created artifact in my store named newartifact.
$ podman artifact ls
REPOSITORY TAG DIGEST SIZE
quay.io/baude/newartifact 1f482de05888 1.049GB
Notice the artifact’s digest and size.
You can now append another artifact file to the existing artifact in your store using the podman artifact add --append
command like below (the artifact file being appended is roughly 200MB in size)
$ podman artifact add --append quay.io/baude/newartifact /home/baude/newartifact2
819d8032f61591ac707fe6cd8347124f229137ace25555f87836c13662cf2178
Podman will add the artifact file to the existing artifact’s manifest and recompute its digest (as seen above).
$ podman artifact ls
REPOSITORY TAG DIGEST SIZE
quay.io/baude/newartifact 819d8032f615 1.258GB
The digest is now changed and you can note an approximate increase in the artifact’s size by 200MB.
The second feature to be merged into our main branch was a new artifact command altogether. Early user feedback of artifacts was that they wanted to be able to add to an already existing artifact in the managed store.. As such, Paul Holzinger added a new command for extracting artifact files from the managed store. The command is capable of extracting a singular file or all the files from the artifact.
Suppose we have a fictitious artifact in our store called quay.io/podman/banner.
$ podman artifact ls
REPOSITORY TAG DIGEST SIZE
quay.io/podman/banner latest ede5670a0dcb 325B
If you want to see the files in this artifact, you only need to know the name of the artifact and have an existing directory where you want the extracted content to be written. In this case, we want to extract quay.io/podman/banner:latest to a directory called /home/baude/whatsintheartifact/.
$ podman artifact extract quay.io/podman/banner:latest /home/baude/whatsintheartifact/
And now I can see the contents of the file in the artifact. The name of the file is determined by the title annotation of the artifact file. The title annotation can be observed with the podman artifact inspect
command.
$ cat /home/baude/whatsintheartifact/banner.txt
___ __
/ _ \___ ___/ /_ _ ___ ____
/ ___/ _ \/ _ / ' \/ _ `/ _ \
/_/ \___/\_,_/_/_/_/\_,_/_//_/
Daemonless, open source, secure, Linux native tool
designed to make it easy to find, run, build, share
and deploy applications using (OCI) Containers and
Container Images.
https://podman.io
This command also has multiple flags that change its behavior. Check out its man page for more information and examples.
Leave a Reply