garbage_collections
Creates, updates, deletes, gets or lists a garbage_collections
resource.
Overview
Name | garbage_collections |
Type | Resource |
Id | digitalocean.container_registry.garbage_collections |
Fields
The following fields are returned by SELECT
queries:
- registries_list_garbage_collections
The response will be a JSON object with a key of garbage_collections
. This will be set to an array containing objects representing each past garbage collection. Each will contain the standard Garbage Collection attributes.
Name | Datatype | Description |
---|---|---|
registry_name | string | The name of the container registry. (example: example) |
blobs_deleted | integer | The number of blobs deleted as a result of this garbage collection. |
created_at | string (date-time) | The time the garbage collection was created. (example: 2020-10-30T21:03:24Z) |
freed_bytes | integer | The number of bytes freed as a result of this garbage collection. |
status | string | The current status of this garbage collection. (example: requested) |
updated_at | string (date-time) | The time the garbage collection was last updated. (example: 2020-10-30T21:03:44Z) |
uuid | string | A string specifying the UUID of the garbage collection. (example: eff0feee-49c7-4e8f-ba5c-a320c109c8a8) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
registries_list_garbage_collections | select | registry_name | per_page , page | To get information about past garbage collections for a registry, send a GET request to /v2/registry/$REGISTRY_NAME/garbage-collections . |
registries_update_garbage_collection | replace | registry_name , garbage_collection_uuid | To cancel the currently-active garbage collection for a registry, send a PUT request to /v2/registries/$REGISTRY_NAME/garbage-collection/$GC_UUID and specify one or more of the attributes below. It is similar to PUT /v2/registries/$REGISTRY_NAME/garbage-collection/$GC_UUID and exists for backward compatibility. | |
registries_run_garbage_collection | exec | registry_name | Garbage collection enables users to clear out unreferenced blobs (layer & manifest data) after deleting one or more manifests from a repository. If there are no unreferenced blobs resulting from the deletion of one or more manifests, garbage collection is effectively a noop. See here for more information about how and why you should clean up your container registry periodically. To request a garbage collection run on your registry, send a POST request to /v2/registries/$REGISTRY_NAME/garbage-collection . This will initiate thefollowing sequence of events on your registry. * Set the registry to read-only mode, meaning no further write-scoped JWTs will be issued to registry clients. Existing write-scoped JWTs will continue to work until they expire which can take up to 15 minutes. * Wait until all existing write-scoped JWTs have expired. * Scan all registry manifests to determine which blobs are unreferenced. * Delete all unreferenced blobs from the registry. * Record the number of blobs deleted and bytes freed, mark the garbage collection status as success .* Remove the read-only mode restriction from the registry, meaning write-scoped JWTs will once again be issued to registry clients. | |
registry_run_garbage_collection_legacy | exec | registry_name | Garbage collection enables users to clear out unreferenced blobs (layer & manifest data) after deleting one or more manifests from a repository. If there are no unreferenced blobs resulting from the deletion of one or more manifests, garbage collection is effectively a noop. See here for more information about how and why you should clean up your container registry periodically. To request a garbage collection run on your registry, send a POST request to /v2/registry/$REGISTRY_NAME/garbage-collection . This will initiate thefollowing sequence of events on your registry. * Set the registry to read-only mode, meaning no further write-scoped JWTs will be issued to registry clients. Existing write-scoped JWTs will continue to work until they expire which can take up to 15 minutes. * Wait until all existing write-scoped JWTs have expired. * Scan all registry manifests to determine which blobs are unreferenced. * Delete all unreferenced blobs from the registry. * Record the number of blobs deleted and bytes freed, mark the garbage collection status as success .* Remove the read-only mode restriction from the registry, meaning write-scoped JWTs will once again be issued to registry clients. | |
registry_get_garbage_collection_legacy | exec | registry_name | To get information about the currently-active garbage collection for a registry, send a GET request to /v2/registry/$REGISTRY_NAME/garbage-collection . | |
registry_list_garbage_collections_legacy | exec | registry_name | per_page , page | To get information about past garbage collections for a registry, send a GET request to /v2/registry/$REGISTRY_NAME/garbage-collections . |
registry_update_garbage_collection_legacy | exec | registry_name , garbage_collection_uuid | To cancel the currently-active garbage collection for a registry, send a PUT request to /v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID and specify one or more of the attributes below. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
garbage_collection_uuid | string | The UUID of a garbage collection run. (example: eff0feee-49c7-4e8f-ba5c-a320c109c8a8) |
registry_name | string | The name of a container registry. (example: example) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
SELECT
examples
- registries_list_garbage_collections
To get information about past garbage collections for a registry, send a GET request to /v2/registry/$REGISTRY_NAME/garbage-collections
.
SELECT
registry_name,
blobs_deleted,
created_at,
freed_bytes,
status,
updated_at,
uuid
FROM digitalocean.container_registry.garbage_collections
WHERE registry_name = '{{ registry_name }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}';
REPLACE
examples
- registries_update_garbage_collection
To cancel the currently-active garbage collection for a registry, send a PUT request to /v2/registries/$REGISTRY_NAME/garbage-collection/$GC_UUID
and specify one or more of the attributes below. It is similar to PUT /v2/registries/$REGISTRY_NAME/garbage-collection/$GC_UUID
and exists for backward compatibility.
REPLACE digitalocean.container_registry.garbage_collections
SET
data__cancel = {{ cancel }}
WHERE
registry_name = '{{ registry_name }}' --required
AND garbage_collection_uuid = '{{ garbage_collection_uuid }}' --required
RETURNING
garbage_collection;
Lifecycle Methods
- registries_run_garbage_collection
- registry_run_garbage_collection_legacy
- registry_get_garbage_collection_legacy
- registry_list_garbage_collections_legacy
- registry_update_garbage_collection_legacy
Garbage collection enables users to clear out unreferenced blobs (layer &
manifest data) after deleting one or more manifests from a repository. If
there are no unreferenced blobs resulting from the deletion of one or more
manifests, garbage collection is effectively a noop.
See here for more information
about how and why you should clean up your container registry periodically.
To request a garbage collection run on your registry, send a POST request to/v2/registries/$REGISTRY_NAME/garbage-collection
. This will initiate the
following sequence of events on your registry.
* Set the registry to read-only mode, meaning no further write-scoped
JWTs will be issued to registry clients. Existing write-scoped JWTs will
continue to work until they expire which can take up to 15 minutes.
* Wait until all existing write-scoped JWTs have expired.
* Scan all registry manifests to determine which blobs are unreferenced.
* Delete all unreferenced blobs from the registry.
* Record the number of blobs deleted and bytes freed, mark the garbage
collection status as success
.
* Remove the read-only mode restriction from the registry, meaning write-scoped
JWTs will once again be issued to registry clients.
EXEC digitalocean.container_registry.garbage_collections.registries_run_garbage_collection
@registry_name='{{ registry_name }}' --required;
Garbage collection enables users to clear out unreferenced blobs (layer &
manifest data) after deleting one or more manifests from a repository. If
there are no unreferenced blobs resulting from the deletion of one or more
manifests, garbage collection is effectively a noop.
See here for more information
about how and why you should clean up your container registry periodically.
To request a garbage collection run on your registry, send a POST request to/v2/registry/$REGISTRY_NAME/garbage-collection
. This will initiate the
following sequence of events on your registry.
* Set the registry to read-only mode, meaning no further write-scoped
JWTs will be issued to registry clients. Existing write-scoped JWTs will
continue to work until they expire which can take up to 15 minutes.
* Wait until all existing write-scoped JWTs have expired.
* Scan all registry manifests to determine which blobs are unreferenced.
* Delete all unreferenced blobs from the registry.
* Record the number of blobs deleted and bytes freed, mark the garbage
collection status as success
.
* Remove the read-only mode restriction from the registry, meaning write-scoped
JWTs will once again be issued to registry clients.
EXEC digitalocean.container_registry.garbage_collections.registry_run_garbage_collection_legacy
@registry_name='{{ registry_name }}' --required
@@json=
'{
"type": "{{ type }}"
}';
To get information about the currently-active garbage collection for a registry, send a GET request to /v2/registry/$REGISTRY_NAME/garbage-collection
.
EXEC digitalocean.container_registry.garbage_collections.registry_get_garbage_collection_legacy
@registry_name='{{ registry_name }}' --required;
To get information about past garbage collections for a registry, send a GET request to /v2/registry/$REGISTRY_NAME/garbage-collections
.
EXEC digitalocean.container_registry.garbage_collections.registry_list_garbage_collections_legacy
@registry_name='{{ registry_name }}' --required,
@per_page='{{ per_page }}',
@page='{{ page }}';
To cancel the currently-active garbage collection for a registry, send a PUT request to /v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID
and specify one or more of the attributes below.
EXEC digitalocean.container_registry.garbage_collections.registry_update_garbage_collection_legacy
@registry_name='{{ registry_name }}' --required,
@garbage_collection_uuid='{{ garbage_collection_uuid }}' --required
@@json=
'{
"cancel": {{ cancel }}
}';