you need jq
first.
Steps:
- download the script && chmod +x
- enable "delete" inside docker registry container
/etc/docker/registry/config.yml
storage:
delete:
enabled: true
- restart registry container
- exec script (note: you can use
2>&1 | tee
to output the result to both a file and standard output) docker exec -it {registry-id} /bin/registry garbage-collect /etc/docker/registry/config.yml
- stop registry container && start registry container