GithubHelp home page GithubHelp logo

ductnn / prune_docker Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.49 MB

A simple tool for removing images and containers untagged ๐Ÿณ ๐Ÿณ ๐Ÿณ

Home Page: https://ductn.info/prune-docker/

License: MIT License

Python 100.00%
python3 docker images containers

prune_docker's Introduction

Prune Docker

PRs Welcome license

A lazy tool for removing images and containers untagged in your machine written in Python.

Feature

  • Remove images have tag <none>.
  • Remove containers do not running.

Usage

Requirements:

  • Python 3.5+
  • Docker version 20.10.7, build f0df350: In my case.

Follow command:

git clone https://github.com/ductnn/prune_docker.git
cd prune_docker
python3 prune.py

The sample result:

  • Before:
โžœ  prune_docker git:(master) โœ— docker images
REPOSITORY                                                                        TAG                           IMAGE ID       CREATED          SIZE
shopping-uat                                                                      latest                        66bf3ddd6ec9   3 minutes ago    447MB
<none>                                                                            <none>                        ef8afc9c41fa   24 minutes ago   447MB
shopping-dev                                                                      latest                        2656e2f6e416   25 minutes ago   447MB
shopping-test                                                                     latest                        e6155d41b61d   26 minutes ago   447MB
ductn4/pharma-server-dev                                                          latest                        b3bcb3f3d042   33 hours ago     288MB
ductn4/pharma-server-test                                                         latest                        b279bfa64352   33 hours ago     288MB
ductn4/pharma-server                                                              latest                        73a0a0737bec   33 hours ago     288MB
dev/django-prometheus-demo                                                        latest                        c9cdb14b3543   2 days ago       75.4MB
ductn4/node                                                                       15-alpine                     263ef415ed2e   4 days ago       118MB
071800817092.dkr.ecr.us-east-2.amazonaws.com/vin21083                             web-ecom-latest               b751e9a2e8a0   4 days ago       552MB
web-ecom-dev                                                                      latest                        b5a529e54884   6 days ago       850MB
prom/prometheus                                                                   latest                        c10e9cbf22cd   6 days ago       194MB
web-ecom-test                                                                     latest                        04d007b17e2b   7 days ago       2.18GB
ductn4/pm2                                                                        16-alpine                     e6d2f5ea8099   10 days ago      158MB
npb-test2                                                                         latest                        41d0ee7411fa   11 days ago      173MB
ductn4/pm2                                                                        15-alpine                     efd577a4ff6b   11 days ago      156MB
ductn4/pm2                                                                        latest                        efd577a4ff6b   11 days ago      156MB
071800817092.dkr.ecr.us-east-2.amazonaws.com/vin21083/web-dashboard-latest        latest                        1716ae765ee6   11 days ago      188MB
<none>                                                                            <none>                        fa1fa473ddbc   11 days ago      447MB
npb-test                                                                          latest                        9452f53960ae   12 days ago      170MB
071800817092.dkr.ecr.us-east-2.amazonaws.com/vin21083/vinivialive-social-latest   latest                        1b7a0cf5fdd9   2 weeks ago      446MB
071800817092.dkr.ecr.us-east-2.amazonaws.com/vin21083                             vinivialive-social-latest     746313c3b4c6   2 weeks ago      446MB
071800817092.dkr.ecr.us-east-2.amazonaws.com/vin21083                             vinivialive-shopping-latest   723c040bdc31   2 weeks ago      446MB
<none>                                                                            <none>                        841ae6d7cb82   2 weeks ago      446MB
  • Run script:
โžœ  prune_docker git:(master) โœ— python3 prune.py
# Id of untagged images
['ef8afc9c41fa', 'fa1fa473ddbc', '841ae6d7cb82']
Removing untagged images...
b'Deleted: sha256:ef8afc9c41fa090f801a13610a9c2db38d58fcda49732ccce321dacf2c35f303\n'
b'Deleted: sha256:fa1fa473ddbcad9519b176fdc9f10002b6d4dac4252de705c5833e6610a63254\n'
b'Deleted: sha256:841ae6d7cb82057fdc2fc749465549ba6a9a3715ff454eb1f36a1a96152ebcf8\n'
Done !!! ๐Ÿณ ๐Ÿณ ๐Ÿณ
  • Check result:

So very ... clean ๐Ÿ˜… ๐Ÿ˜… ๐Ÿ˜….

Show your support

Give a โญ if you like this application โค๏ธ

License

The MIT License (MIT). Please see LICENSE for more information.

prune_docker's People

Contributors

ductnn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.