https://github.com/a0s/cloud-cleaner-rb
Handmade "docker prune" for docker swarm services.
https://github.com/a0s/cloud-cleaner-rb
Last synced: about 1 month ago
JSON representation
Handmade "docker prune" for docker swarm services.
- Host: GitHub
- URL: https://github.com/a0s/cloud-cleaner-rb
- Owner: a0s
- License: mit
- Created: 2019-06-26T10:26:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-16T22:34:15.000Z (over 6 years ago)
- Last Synced: 2025-04-12T06:37:50.868Z (over 1 year ago)
- Language: Ruby
- Homepage: https://github.com/a0s/cloud-cleaner-rb
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cloud-cleaner
```bash
./services --help
Removes old (after time threshold) docker swarm services.
Usage: services [options]
--threshold=[TIME] (required) Relative time threshold, example: "2 days ago"
--destructive Run in destructive mode
--host=[URI|SOCKET] Remote docker uri (http://...) or local socket (unix://...), default: unix:///var/run/docker.sock
--exclude-names=[STRING,STRING]
Exclude name from deletion process
```
## Examples
Dry-run to show what will be delete
```bash
./services --threshold="2 days ago" --exclude-names="registrator"
```
and then real deletion
```bash
./services --threshold="2 days ago" --exclude-names="registrator" --destructive
```
In case you want temporary remote connection to `/var/run/docker.sock` from other host (eg. local machine) you can use
`socat` (described in [Forwarding TCP-traffic to a UNIX socket](https://coderwall.com/p/c3wyzq/forwarding-tcp-traffic-to-a-unix-socket)).
For example, for remote port 11111
```bash
./services --host="http://remote-swarm-host:11111" --threshold="2 days ago" --exclude-names="registrator" --destructive
```
## TODO
* Periodical running without cron
* Image cleaner by [age, count].[min,max] conditions