containers / image

Work with containers' images
Apache License 2.0
848 stars 367 forks source link

Feature request - skopeo delete - oci transport support #1812

Closed adamjk-dev closed 9 months ago

adamjk-dev commented 1 year ago

Team,

I was trying to use skopeo delete on an oci dir, but it says it is not supported.

# Version:
[root@f92b09f8f41d /]# skopeo -v
skopeo version 1.10.0

# Where oci blobs are copied to:
[root@f92b09f8f41d /]# ls /tmp/oci/
blobs  index.json  oci-layout
[root@f92b09f8f41d /]# ls /tmp/oci/blobs/sha256/
08d4142e00fa43623da04b84f9c317394222beb122c5aacf257fedc25359511c  56323cd6ef40446f7c91f10ed3d49e03bb0756cfd8e2e54a6c8ca5ca8faff95b  b06479f0251ef9e2479c2e306c348013af3fe72972d20b429f12f612f168f83b
0da5beca8a70991c6157553d3764c01857bb1bfc79da43376a513cf3de0408c9  58ecb51bf8df347875b75043c0a028e4a1b1856259ae64d213a7524f48af602b  c38f956b642366c8eeb0babfda6b0bb2aa92f27a968589804cadb445f6df72d6
118053baf4078ae6b20697458623d06588140f3275a6ac53a5097144023984ff  63da027fd9b2e19d0c670573210a21f72fa44400768378e5d020d3bdf18c65a9  e1d2683c3b360b3a77d504be68845d87a7bb2c6d69427fe3ac5fa5885d5c41a1
242f6bf0782471efc52b065a877857a72b41b291fd0bb11889009284b524f6d2  927186e5431fea9b89fd1bc8fd03907afb2e6ba28d5506941e7a1c93bbe57783  f93305d9afaa227bad926f9c5d3d251a883b0f56d28df45f2cdb01499a3837c2
273f472f079141ae843786373afa19b7d37077468ed8aee554bc239a8a8ab82b  a651549cc993b483bfea8a86fc3f93e75ce7bb86e529f067b6d5396f283af73b
3335047945abe10da4804c31db8684ec53f851e29f87dc60237832e399b5a322  adde438766626bf98f72207f244fafc6e9f6cd9773e4e669f0673790057945ad

# Attempt to delete (what I was hoping would work):
[root@f92b09f8f41d /]# skopeo delete oci:///tmp/oci:mcr.microsoft.com/containernetworking/azure-cns:v1.4.27
FATA[0000] Deleting images not implemented for oci: images

# Help on delete command:
[root@f92b09f8f41d /]# skopeo delete --help
Delete an "IMAGE_NAME" from a transport
Supported transports:
containers-storage, dir, docker, docker-archive, docker-daemon, oci, oci-archive, ostree, sif, tarball
See skopeo(1) section "IMAGE NAMES" for the expected format

Usage:
skopeo delete [command options] IMAGE-NAME

Examples:
skopeo delete docker://registry.example.com/example/pause:latest

Flags:
      --authfile string             path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json (default "/tmp/auth.json")
      --cert-dir PATH               use certificates at PATH (*.crt, *.cert, *.key) to connect to the registry or daemon
      --creds USERNAME[:PASSWORD]   Use USERNAME[:PASSWORD] for accessing the registry
      --daemon-host HOST            use docker daemon host at HOST (docker-daemon: only)
  -h, --help                        help for delete
      --no-creds                    Access the registry anonymously
      --password string             Password for accessing the registry
      --registry-token string       Provide a Bearer token for accessing the registry
      --retry-times int             the number of times to possibly retry
      --shared-blob-dir DIRECTORY   DIRECTORY to use to share blobs across OCI repositories
      --tls-verify                  require HTTPS and verify certificates when talking to the container registry or daemon
      --username string             Username for accessing the registry

The following steps can be used to reproduce:

[root@ad7c07440677 /]# mkdir /tmp/oci
[root@ad7c07440677 /]# ll /tmp/oci/
total 0
[root@ad7c07440677 /]# skopeo copy --preserve-digests docker://mcr.microsoft.com/containernetworking/azure-cns:v1.4.27 oci:///tmp/oci:mcr.microsoft.com/containernetworking/azure-cns:v1.4.27
Getting image source signatures
Copying blob 273f472f0791 done
Copying config 58ecb51bf8 done
Writing manifest to image destination
Storing signatures
[root@ad7c07440677 /]# ll /tmp/oci/
total 8
drwxr-xr-x. 3 root root  60 Jan 21 13:36 blobs
-rw-r--r--. 1 root root 296 Jan 21 13:36 index.json
-rw-r--r--. 1 root root  31 Jan 21 13:36 oci-layout
[root@ad7c07440677 /]# cat /tmp/oci/index.json | grep cns
{"schemaVersion":2,"manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:3335047945abe10da4804c31db8684ec53f851e29f87dc60237832e399b5a322","size":350,"annotations":{"org.opencontainers.image.ref.name":"mcr.microsoft.com/containernetworking/azure-cns:v1.4.27"}}]}
[root@ad7c07440677 /]# skopeo delete oci:///tmp/oci:mcr.microsoft.com/containernetworking/azure-cns:v1.4.27
FATA[0000] Deleting images not implemented for oci: images
[root@ad7c07440677 /]# skopeo -v
skopeo version 1.10.0
mtrmac commented 1 year ago

Thanks for your report. That would need to be implemented in c/image, moving there.

Pvlerick commented 9 months ago

This can be closed now

mtrmac commented 9 months ago

Thanks again!