Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ceccode committed Aug 16, 2018
0 parents commit 8a69d10
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# OS X files
.AppleDB/
.AppleDesktop/
.AppleDouble/
.DocumentRevisions-V100/
.fseventsd/
.Spotlight-V100/
.TemporaryItems/
.Trashes/
Network Trash Folder/
Temporary Items/
._*
.apdisk
.com.apple.timemachine.donotpresent
.DS_Store
.LSOverride
.VolumeIcon.icns
# Icon must end with two carriage returns (\r)
Icon

# Windows files
$RECYCLE.BIN/
Desktop.ini
ehthumbs.db
Thumbs.db

# Vim files
*~
*.swp

# vim: syntax=conf cc=80 tw=79 ts=4 sw=4 sts=4 et sr

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Francesco Falanga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SDED

SDED (Stop Docker eating disk space) is a mini superset of the docker command that help to cleanup disk space eat by docker.

`sded.sh` is a simple bash script.

## Shorcuts

```bash
h: show this help text
l: see list of running containers
i: see list of stored images
od: delete orphaned and dangling volumes
du: delete dangling and untagged images
```

## Installation

Copy `sded.sh` in your usr/local/bin directory.

## How to contribute

Have an idea? Found a bug? Contributions are more than welcome!
50 changes: 50 additions & 0 deletions sded.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Mini superset of the docker command that help to cleanup disk space eat by docker

# Traps any error (see https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html)
set -e -o pipefail -u

dkrshelp () {
cat <<EOT
Usage: $(basename "$0") [h] [l,i,od,du] -- cleanup disk space eat by docker
where:
h: show this help text
l: see list of running containers
i: see list of stored images
od: delete orphaned and dangling volumes
du: delete dangling and untagged images
EOT
exit 0
}

argc=${#}
if [[ ${argc} -eq 0 ]]; then
dkrshelp
fi

cmd=${1}

case ${cmd} in
h)
dkrshelp
;;
-h)
dkrshelp
;;
l)
docker ps
;;
i)
docker images
;;
od)
docker volume rm $(docker volume ls -qf dangling=true)
;;
du)
docker rmi $(docker images -q -f dangling=true)
;;
*)
dkrshelp
;;
esac

0 comments on commit 8a69d10

Please sign in to comment.