{"id":18778940,"url":"https://github.com/ramsailopal/docker-local-repo","last_synced_at":"2026-05-07T13:43:24.345Z","repository":{"id":127741987,"uuid":"607117357","full_name":"RamSailopal/docker-local-repo","owner":"RamSailopal","description":"Simple bash script to retain last x number of images for each repo when hosting Docker registry on local network","archived":false,"fork":false,"pushed_at":"2023-03-02T19:00:51.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T05:37:16.205Z","etag":null,"topics":["bash","bash-script","docker","docker-registry"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RamSailopal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-27T10:54:34.000Z","updated_at":"2023-02-27T11:19:01.000Z","dependencies_parsed_at":"2023-08-17T09:31:17.185Z","dependency_job_id":null,"html_url":"https://github.com/RamSailopal/docker-local-repo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RamSailopal/docker-local-repo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamSailopal%2Fdocker-local-repo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamSailopal%2Fdocker-local-repo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamSailopal%2Fdocker-local-repo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamSailopal%2Fdocker-local-repo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RamSailopal","download_url":"https://codeload.github.com/RamSailopal/docker-local-repo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamSailopal%2Fdocker-local-repo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263986258,"owners_count":23539809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","docker","docker-registry"],"created_at":"2024-11-07T20:17:51.691Z","updated_at":"2026-05-07T13:43:19.310Z","avatar_url":"https://github.com/RamSailopal.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-local-repo\n\nSimple bash script to retain last x number of images for each repo when hosting images on \"local\" network. Useful in a devops CI/CD context where new images are being deployed with a high frequency and there is a potential for \"rollbacks\"\n\n# Pre-requisites\n\nThe script assumes that a \"local network\" Docker registry container is already running on the same machine as the machine running the main repoclean.sh script. Details of running a local Docker registry can be found here\n\nhttps://docs.docker.com/registry/deploying/\n\n# Running the script\n\n**Considerations** - For a large number of repos/images, this script is not an optimal solution.\n\nThe script will first pull all repo images to the local Docker repo. It then will stop the container running the registry, remove the mapped persistent storage and restart the container before pushing images back based on the retention index passed. An index of 3 for example will keep the last 3, most recent images for each repo and then delete the other images. Because images are pulled locally as a first stage, it is important to ensure that enough space is available to run the script.\n\nTo execute the script run:\n\n    ./repoclean 3 \"192.168.240.9:5000/Ram\" \"/var/docker-images\"\n    \nWhere 3 is the number of images for each repo to keep, 192.168.140.9:5000/Ram is the address of the registry as well as the name of the user hosting the repo and /var/docker-images is the local registry container persistent storage.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framsailopal%2Fdocker-local-repo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framsailopal%2Fdocker-local-repo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framsailopal%2Fdocker-local-repo/lists"}