{"id":27334958,"url":"https://github.com/dmuth/docker-remove-dependent-child-images","last_synced_at":"2025-08-12T01:23:41.070Z","repository":{"id":138470232,"uuid":"222323585","full_name":"dmuth/docker-remove-dependent-child-images","owner":"dmuth","description":"Script to remove dependent child images of a Docker Container","archived":false,"fork":false,"pushed_at":"2021-05-22T02:44:31.000Z","size":214,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T14:51:30.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmuth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2019-11-17T22:55:36.000Z","updated_at":"2024-09-27T08:44:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"818d3299-d068-43ae-b9ca-114e18cd3989","html_url":"https://github.com/dmuth/docker-remove-dependent-child-images","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dmuth/docker-remove-dependent-child-images","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fdocker-remove-dependent-child-images","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fdocker-remove-dependent-child-images/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fdocker-remove-dependent-child-images/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fdocker-remove-dependent-child-images/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmuth","download_url":"https://codeload.github.com/dmuth/docker-remove-dependent-child-images/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuth%2Fdocker-remove-dependent-child-images/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269983697,"owners_count":24507650,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-04-12T14:46:44.169Z","updated_at":"2025-08-12T01:23:41.061Z","avatar_url":"https://github.com/dmuth.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n**Update 21 May 2021**: I learned a new trick which probably makes this script completely unnecessary--just running `docker rmi $(docker images --filter \"dangling=true\" -q )` should do the trick.  I will keep this script around for legacy reasons, though.\n\n\n# Script to remove dependent child images of a Docker Container\n\nAs much as I love using Docker, one of the frustrations I have is when I try to remove an \nan image which other images are based on, only to get this error:\n\n```\n$ docker rmi b171179240df\nError response from daemon: conflict: unable to delete b171179240df (cannot be forced) - image has dependent child images\n```\n\nI did some searches on Google, and most of the advice centered around the heavy-handed approach of\nremoving **all** Docker images and basically starting over with a clean slate.  That approach didn't set well\nwith me because it doesn't strike me as all that efficient, and also causes me to have to spend more time\nwaiting for unrelated containers to build.\n\nThat prompted me to write a script which, when provided with the ID of a container to remove, will\nrecurse through all child containers and delete them first.\n\n\n## Quick and Dirty Usage\n\n`bash \u003c(curl -s https://raw.githubusercontent.com/dmuth/docker-remove-dependent-child-images/master/docker-remove-image) IMAGE_ID`\n\nThat will delete the image IMAGE_ID, and all child images.  \n\nNo muss, no fuss, no awkward explanations to senior engineers.\n\n\n## Sample Output\n\nOutput of the run of `demo.sh`:\n\n\u003cimg src=\"./img/demo.png\" /\u003e\n\n\n## Development\n\n- Run the script `./tests.sh` to create some nested containers and then run this script.\n\n\n## Contact\n\n- Email: doug.muth AT gmail DOT com\n- \u003ca href=\"http://twitter.com/dmuth\"\u003e@dmuth on Twitter\u003c/a\u003e \n- \u003ca href=\"http://facebook.com/dmuth\"\u003eFacebook\u003c/a\u003e\n- \u003ca href=\"https://www.dmuth.org/\"\u003eBlog\u003c/a\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuth%2Fdocker-remove-dependent-child-images","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmuth%2Fdocker-remove-dependent-child-images","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuth%2Fdocker-remove-dependent-child-images/lists"}