Skip to content

Instantly share code, notes, and snippets.

@Kevinrob
Last active August 21, 2025 13:39
Show Gist options
  • Save Kevinrob/4c7f1e5dbf6ce4e94d6ba2bfeff37aeb to your computer and use it in GitHub Desktop.
Save Kevinrob/4c7f1e5dbf6ce4e94d6ba2bfeff37aeb to your computer and use it in GitHub Desktop.

Revisions

  1. Kevinrob revised this gist Jan 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion clean.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,6 @@ for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
    done
    done
    ```
    `kubectl get pods`
    `kubectl get pods --namespace="container-registry"`
    `kubectl exec -it --namespace="container-registry" registry-... bash`
    `bin/registry garbage-collect /etc/docker/registry/config.yml`
  2. Kevinrob revised this gist Nov 21, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion clean.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    ```
    repositories=$(curl localhost:32000/v2/_catalog)
    registry=localhost:32000
    repositories=$(curl ${registry}/v2/_catalog)
    for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
    echo $repo
    tags=$(curl -sSL "http://${registry}/v2/${repo}/tags/list" | jq -r '.tags[]')
  3. Kevinrob revised this gist Nov 21, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions clean.md
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,6 @@ for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
    done
    done
    ```
    `kubectl get pods`
    `kubectl exec -it --namespace="container-registry" registry-... bash`
    `bin/registry garbage-collect /etc/docker/registry/config.yml`
    `kubectl get pods`
    `kubectl exec -it --namespace="container-registry" registry-... bash`
    `bin/registry garbage-collect /etc/docker/registry/config.yml`
  4. Kevinrob created this gist Nov 21, 2019.
    20 changes: 20 additions & 0 deletions clean.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    ```
    repositories=$(curl localhost:32000/v2/_catalog)
    for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
    echo $repo
    tags=$(curl -sSL "http://${registry}/v2/${repo}/tags/list" | jq -r '.tags[]')
    for tag in $tags; do
    echo $tag
    curl -v -sSL -X DELETE "http://${registry}/v2/${repo}/manifests/$(
    curl -sSL -I \
    -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
    "http://${registry}/v2/${repo}/manifests/$tag" \
    | awk '$1 == "Docker-Content-Digest:" { print $2 }' \
    | tr -d $'\r' \
    )"
    done
    done
    ```
    `kubectl get pods`
    `kubectl exec -it --namespace="container-registry" registry-... bash`
    `bin/registry garbage-collect /etc/docker/registry/config.yml`