You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The media type can be incorrect and a source of error when the artifact gets pushed to an OCI container image registry.
Consider the following example:
# run Zot (https://zotregistry.dev) on localhost:5001
podman run -d -p "127.0.0.1:5001:5000" --name zot ghcr.io/project-zot/zot-minimal-linux-amd64:latest
# create hello.yaml and an artifact hello:latest
echo "foo: bar" > hello.yaml
podman artifact add localhost:5001/hello/hello:latest ./hello.yaml
# verify that the layer's media type is `text/plain; charset=utf-8`
podman artifact inspect localhost:5001/hello/hello:latest | jq '.Manifest.layers[].mediaType'
# push it to Zot
podman artifact push docker://localhost:5001/hello/hello:latest
Pushing the artifact returns an error:
Error: invalid reference format
The media type inferred by DetectContentType (text/plain; charset=utf-8) is the issue:
@nalind@baude would it make sense to set artifacts layer's Media Type to application/vnd.oci.image.layer.v1.tar by default rather than trying to guess the type with net/http#DetectContentType? That's what ORAS does anyway.
in containers#25884, it was pointed out that the standard detection used to
determine the artifact's file type can be wrong. in those cases, it
would be handy for the user to be able to override the media type of the
layer. as such, added a new option called `--file-type`, which is
optional, and allows users to do just that.
`podman artifact add --file-type text/yaml
quay.io/artifact/config:latest ./config.yaml `
Fixes: containers#25884
Signed-off-by: Brent Baude <[email protected]>
Feature request description
The media type of artifacts files is derived from the first 512 bytes of the file using go standard library net/http#DetectContentType.
The media type can be incorrect and a source of error when the artifact gets pushed to an OCI container image registry.
Consider the following example:
Pushing the artifact returns an error:
The media type inferred by
DetectContentType
(text/plain; charset=utf-8
) is the issue:charset
parameter and the support for media types parameters is controversialtext/yaml
would be more appropriate)Suggest potential solution
To address these cases,
podman artifact add
should have a flag to specify the files' media types.The text was updated successfully, but these errors were encountered: