regclient / regclient

Docker and OCI Registry Client in Go and tooling using those libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ìmage mod --label` change the config mediatype

laupse opened this issue · comments

Current Behavior

Using image mod to add or change labels of the image is changing the mediatype from application/vnd.docker.container.image.v1+json to application/octet-stream

regctl manifest diff localhost:5001/alpine:test localhost:5001/alpine --host tls=disabled,reg=localhost:5001
@@ -2,9 +2,9 @@
    "schemaVersion": 2,
    "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
    "config": {
-     "mediaType": "application/octet-stream",
-     "digest": "sha256:aae2036d9fac085bc134b1f6e66851e1679987bf4f02bbe52f8d9a61379c1c66",
-     "size": 610
+     "mediaType": "application/vnd.docker.container.image.v1+json",
+     "size": 1472,
+     "digest": "sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd"
    },

This might be the root cause of not being able to pull the modified image from kubernetes

Error: failed to create containerd container: error unpacking image: failed to extract layer sha256:5d12659955d5f1e588d826a8167277d9c3b4530db62e1ff82949b5ff621ff027: failed to get reader from content store: content digest sha256:1b95cff5bfd5d60f82ca7c9b10fec1caefa1caadbef690b9af7e5205a4df3e50: not found

Expected Behavior

The same media application/vnd.docker.container.image.v1+json and being able to pull from kubernetes

Steps To Reproduce

curl https://kind.sigs.k8s.io/examples/kind-with-registry.sh | bash

regctl image copy alpine localhost:5001/alpine --host tls=disabled,reg=localhost:5001
# or 
docker tag alpine localhost:5001/alpine
docker push localhost:5001/alpine

regctl image mod localhost:5001/alpine --host tls=disabled,reg=localhost:5001 --label test=test --create test
regctl manifest diff localhost:5001/alpine:test localhost:5001/alpine --host tls=disabled,reg=localhost:5001

kubectl create deployment works--image=localhost:5001/alpine
kubectl create deployment doesntwork--image=localhost:5001/alpine:test

The kube part is normally reproductible ( my corporate network make it failed, i will update it from another computer) and should show pod from doesntwork not creating

Version

regctl version
VCSTag:     v0.5.7
VCSRef:     832109d4e9ef96982c4a4a8614b276b752509e5b
VCSCommit:  832109d4e9ef96982c4a4a8614b276b752509e5b
VCSState:   clean
VCSDate:    2024-02-06T21:25:52Z
Platform:   linux/amd64
GoVer:      go1.21.6
GoCompiler: gc

Environment

Anything else

Thank you for the report! That was a symptom of a bigger issue. I've got the fix ready to merge, just waiting on GitHub to recover from their issues.

So fast Thanks !