Skip to content

Instantly share code, notes, and snippets.

@myclau
Created November 27, 2018 00:51
Show Gist options
  • Save myclau/97890705471cc1f7d5e86b23752a5db8 to your computer and use it in GitHub Desktop.
Save myclau/97890705471cc1f7d5e86b23752a5db8 to your computer and use it in GitHub Desktop.
Remove image in registry v2
1. Login to the container
`docker exec -it registry sh`
2. Define variables matching your container and container version:
```export NAME="google/cadvisor"
export VERSION="v0.24.1"```
3. Move to the the registry directory:
`cd /var/lib/registry/docker/registry/v2`
4. Delete files related to your hash:
`find . | grep `ls ./repositories/$NAME/_manifests/tags/$VERSION/index/sha256`| xargs rm -rf $1`
5. Delete manifests:
`rm -rf ./repositories/$NAME/_manifests/tags/$VERSION`
6. Logout
`exit`
7. Run the GC:
`docker exec -it registry bin/registry garbage-collect /etc/docker/registry/config.yml`
8. If all was done properly some information about deleted blobs is shown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment