Support deleting an image tag

If the Docker Registry API allows for images to be deleted, issuing the
command `delete <image> <tag>` will result in the tag being removed from
the server.

A limitation of this change is that it will cause any unreferenced tags
to become orphaned, requiring the garbage collector within the docker
registry server to clean these up.  This is because there is no way to
efficiently determine if each of the layers are reused by other tags or
images on the server.

Implement delete logic

Fix broken unit tests
This commit is contained in:
Anthony Oteri
2023-09-29 17:18:04 -04:00
parent 48070cff1f
commit fbe43f03f1
5 changed files with 128 additions and 15 deletions
+10
View File
@@ -32,6 +32,7 @@ Options:
-V, --version
Print version
```
### Checking the API Version
Perform a simple API Version check towards the registry endpoint
@@ -87,6 +88,15 @@ Options:
Delete a tagged image from the registry
Note! This requires that the registry has storage delete rights enabled. For
example, when creating the registry, setting the environment variable
`REGISTRY_STORAGE_DELETE_ENABLED=true` to enable that feature. If that is not
enabled, a `MethodNotAllowed` error will be returned.
Note! This will only remove the tag from the registry, it will not remove
orphaned digests. For that, the garbage collector on the registry service must
be run separately.
```shell
Usage: dredge <REGISTRY> delete <IMAGE> <TAG>