restructure docs
This commit is contained in:
parent
152e7a3f73
commit
e109b9345f
|
@ -1 +1 @@
|
||||||
* Initial release
|
* Initial release after fork
|
||||||
|
|
|
@ -20,4 +20,4 @@ RUN \
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
CMD []
|
CMD []
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-tidy"]
|
ENTRYPOINT ["/usr/local/bin/docker-tidy gc"]
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[![PyPi Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![PyPi Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![License: MIT](https://img.shields.io/github/license/xoxys/docker-tidy)](LICENSE)
|
[![License: MIT](https://img.shields.io/github/license/xoxys/docker-tidy)](LICENSE)
|
||||||
|
|
||||||
This is a fork of [Yelp/docker-custodian](https://github.com/Yelp/docker-custodian). Keep docker hosts tidy.
|
This project is a fork of [Yelp/docker-custodian](https://github.com/Yelp/docker-custodian). Keep docker hosts tidy.
|
||||||
|
|
||||||
You can find the full documentation at [https://docker-tidy.geekdocs.de](https://docker-tidy.geekdocs.de/).
|
You can find the full documentation at [https://docker-tidy.geekdocs.de](https://docker-tidy.geekdocs.de/).
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Config():
|
||||||
},
|
},
|
||||||
"dry_run": {
|
"dry_run": {
|
||||||
"default": False,
|
"default": False,
|
||||||
"env": "DRY_TUN",
|
"env": "DRY_RUN",
|
||||||
"file": True,
|
"file": True,
|
||||||
"type": environs.Env().bool
|
"type": environs.Env().bool
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,78 +9,4 @@ title: Documentation
|
||||||
[![PyPi Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
[![PyPi Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/)
|
||||||
[![License: MIT](https://img.shields.io/github/license/xoxys/docker-tidy)](LICENSE)
|
[![License: MIT](https://img.shields.io/github/license/xoxys/docker-tidy)](LICENSE)
|
||||||
|
|
||||||
## Install
|
This project is a fork of [Yelp/docker-custodian](https://github.com/Yelp/docker-custodian). Keep docker hosts tidy.
|
||||||
|
|
||||||
There are three installation options
|
|
||||||
|
|
||||||
### Container
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker pull xoxys/docker-tidy
|
|
||||||
docker run -ti \
|
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
||||||
xoxys/docker-tidy docker-tidy gc --help
|
|
||||||
```
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
pip install git+https://github.com/xoxys/docker-tidy.git
|
|
||||||
```
|
|
||||||
|
|
||||||
## Garbage Collector
|
|
||||||
|
|
||||||
Remove old docker containers and docker images.
|
|
||||||
|
|
||||||
`docker-tidy gc` will remove stopped containers and unused images that are older
|
|
||||||
than \"max age\". Running containers, and images which are used by a
|
|
||||||
container are never removed.
|
|
||||||
|
|
||||||
Maximum age can be specificied with any format supported by
|
|
||||||
[pytimeparse].
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker-tidy gc --max-container-age 3days --max-image-age 30days
|
|
||||||
```
|
|
||||||
|
|
||||||
### Prevent images from being removed
|
|
||||||
|
|
||||||
`docker-tidy gc` supports an image exclude list. If you have images that you\'d
|
|
||||||
like to keep around forever you can use the exclude list to prevent them
|
|
||||||
from being removed.
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
--exclude-image
|
|
||||||
Never remove images with this tag. May be specified more than once.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Prevent containers and associated images from being removed
|
|
||||||
|
|
||||||
`docker-tidy gc` also supports a container exclude list based on labels. If there
|
|
||||||
are stopped containers that you\'d like to keep, then you can check the
|
|
||||||
labels to prevent them from being removed.
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
--exclude-container-label
|
|
||||||
Never remove containers that have the label key=value. =value can be
|
|
||||||
omitted and in that case only the key is checked. May be specified
|
|
||||||
more than once.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Autostop
|
|
||||||
|
|
||||||
Stop containers that have been running for too long.
|
|
||||||
|
|
||||||
`docker-tidy stop` will `docker stop` containers where the container name starts
|
|
||||||
with [\--prefix]{.title-ref} and/or it has been running for longer than
|
|
||||||
[\--max-run-time]{.title-ref}.
|
|
||||||
|
|
||||||
If no prefix is set, __all__ containers matching the `max-run-time` will be stopped!
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker-tidy stop --max-run-time 2days --prefix "projectprefix_"
|
|
||||||
```
|
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
---
|
||||||
|
title: Configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
*docker-tidy* comes with default settings which should be sufficient for most users to start, but you can adjust most settings to your needs.
|
||||||
|
|
||||||
|
Changes can be made on different locations which will be processed in the following order (last wins):
|
||||||
|
|
||||||
|
* default config (build-in)
|
||||||
|
* global config file (path depends on your operating system)
|
||||||
|
* folder-based config file (.dockertidy.yml|.dockertidy.yaml|.dockertidy in current working dir)
|
||||||
|
* environment variables
|
||||||
|
* cli options
|
||||||
|
|
||||||
|
## Default settings
|
||||||
|
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
{{< highlight YAML "linenos=table" >}}
|
||||||
|
---
|
||||||
|
# don't do anything
|
||||||
|
dry_run: False
|
||||||
|
|
||||||
|
logging:
|
||||||
|
# possible options debug | info | warning | error | critical
|
||||||
|
level: "warning"
|
||||||
|
# you can enable json logging if a parsable output is required
|
||||||
|
json: False
|
||||||
|
|
||||||
|
{{< /highlight >}}
|
||||||
|
<!-- markdownlint-enable -->
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
{{< highlight Shell "linenos=table" >}}
|
||||||
|
TIDY_CONFIG_FILE=
|
||||||
|
TIDY_DRY_RUN=False
|
||||||
|
TIDY_HTTP_TIMEOUT=60
|
||||||
|
TIDY_LOG_LEVEL=warning
|
||||||
|
TIDY_LOG_JSON=False
|
||||||
|
TIDY_GC_MAX_CONTAINER_AGE=
|
||||||
|
TIDY_GC_MAX_IMAGE_AGE=
|
||||||
|
TIDY_GC_DANGLING_VOLUMES=False
|
||||||
|
# comma-separated list
|
||||||
|
TIDY_GC_EXCLUDE_IMAGES=
|
||||||
|
# comma-separated list
|
||||||
|
TIDY_GC_EXCLUDE_CONTAINER_LABELS=
|
||||||
|
TIDY_STOP_MAX_RUN_TIME=
|
||||||
|
# comma-separated list
|
||||||
|
TIDY_STOP_PREFIX=
|
||||||
|
{{< /highlight >}}
|
||||||
|
<!-- markdownlint-enable -->
|
||||||
|
|
||||||
|
## CLI options
|
||||||
|
|
||||||
|
You can get all available cli options by running `docker-tidy --help`:
|
||||||
|
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
{{< highlight Shell "linenos=table" >}}
|
||||||
|
$ docker-tidy --help
|
||||||
|
usage: docker-tidy [-h] [--dry-run] [-t HTTP_TIMEOUT] [-v] [-q] [--version]
|
||||||
|
{gc,stop} ...
|
||||||
|
|
||||||
|
Generate documentation from annotated Ansible roles using templates
|
||||||
|
|
||||||
|
positional arguments:
|
||||||
|
{gc,stop} sub-command help
|
||||||
|
gc Run docker garbage collector.
|
||||||
|
stop Stop containers that have been running for too long.
|
||||||
|
|
||||||
|
optional arguments:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--dry-run Only log actions, don't stop anything.
|
||||||
|
-t HTTP_TIMEOUT, --timeout HTTP_TIMEOUT
|
||||||
|
HTTP timeout in seconds for making docker API calls.
|
||||||
|
-v increase log level
|
||||||
|
-q decrease log level
|
||||||
|
--version show program's version number and exit
|
||||||
|
{{< /highlight >}}
|
||||||
|
<!-- markdownlint-enable -->
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
title: Setup
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pip
|
||||||
|
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
{{< highlight Shell "linenos=table" >}}
|
||||||
|
# From PyPI as unprivilegd user
|
||||||
|
$ pip install docker-tidy --user
|
||||||
|
|
||||||
|
# .. or as root
|
||||||
|
$ sudo pip install docker-tidy
|
||||||
|
|
||||||
|
# From Wheel file
|
||||||
|
$ pip install https://github.com/xoxys/docker-tidy/releases/download/v0.1.0/docker_tidy-0.1.0-py2.py3-none-any.whl
|
||||||
|
{{< /highlight >}}
|
||||||
|
<!-- markdownlint-enable -->
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
{{< highlight Shell "linenos=table" >}}
|
||||||
|
docker run \
|
||||||
|
-e TIDY_GC_MAX_CONTAINER_AGE=3days
|
||||||
|
-e TIDY_GC_MAX_IMAGE_AGE=5days
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
xoxys/docker-tidy
|
||||||
|
{{< /highlight >}}
|
||||||
|
<!-- markdownlint-enable -->
|
||||||
|
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
{{< hint info >}}
|
||||||
|
**Info**\
|
||||||
|
Keep in mind, that you have to pass selinux labels (:Z or :z) to your mount option if you are working on selinux enabled systems.
|
||||||
|
{{< /hint >}}
|
||||||
|
<!-- markdownlint-enable -->
|
|
@ -0,0 +1,60 @@
|
||||||
|
---
|
||||||
|
title: Usage
|
||||||
|
---
|
||||||
|
|
||||||
|
## Garbage Collector
|
||||||
|
|
||||||
|
Remove old docker containers and docker images.
|
||||||
|
|
||||||
|
`docker-tidy gc` will remove stopped containers and unused images that are older
|
||||||
|
than \"max age\". Running containers, and images which are used by a
|
||||||
|
container are never removed.
|
||||||
|
|
||||||
|
Maximum age can be specificied with any format supported by
|
||||||
|
[pytimeparse](https://github.com/wroberts/pytimeparse).
|
||||||
|
|
||||||
|
__Example:__
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker-tidy gc --max-container-age 3days --max-image-age 30days
|
||||||
|
```
|
||||||
|
|
||||||
|
### Prevent images from being removed
|
||||||
|
|
||||||
|
`docker-tidy gc` supports an image exclude list. If you have images that you\'d
|
||||||
|
like to keep around forever you can use the exclude list to prevent them
|
||||||
|
from being removed.
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
--exclude-image
|
||||||
|
Never remove images with this tag. May be specified more than once.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Prevent containers and associated images from being removed
|
||||||
|
|
||||||
|
`docker-tidy gc` also supports a container exclude list based on labels. If there
|
||||||
|
are stopped containers that you\'d like to keep, then you can check the
|
||||||
|
labels to prevent them from being removed.
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
--exclude-container-label
|
||||||
|
Never remove containers that have the label key=value. =value can be
|
||||||
|
omitted and in that case only the key is checked. May be specified
|
||||||
|
more than once.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Autostop
|
||||||
|
|
||||||
|
Stop containers that have been running for too long.
|
||||||
|
|
||||||
|
`docker-tidy stop` will `docker stop` containers where the container name starts
|
||||||
|
with [\--prefix]{.title-ref} and/or it has been running for longer than
|
||||||
|
[\--max-run-time]{.title-ref}.
|
||||||
|
|
||||||
|
If no prefix is set, __all__ containers matching the `max-run-time` will be stopped!
|
||||||
|
|
||||||
|
__Example:__
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
docker-tidy stop --max-run-time 2days --prefix "projectprefix_"
|
||||||
|
```
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
main:
|
||||||
|
- name: Setup
|
||||||
|
ref: "/setup"
|
||||||
|
- name: Configuration
|
||||||
|
ref: "/configuration"
|
||||||
|
- name: Usage
|
||||||
|
ref: "/usage"
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
more:
|
||||||
|
- name: Releases
|
||||||
|
ref: "https://github.com/xoxys/docker-tidy/releases"
|
||||||
|
external: true
|
||||||
|
icon: "download"
|
||||||
|
- name: "View Source"
|
||||||
|
ref: "https://github.com/xoxys/docker-tidy"
|
||||||
|
external: true
|
||||||
|
icon: "github"
|
|
@ -0,0 +1,16 @@
|
||||||
|
ErrorDocument 404 /404.html
|
||||||
|
|
||||||
|
ExpiresActive On
|
||||||
|
ExpiresDefault "access plus 600 seconds"
|
||||||
|
ExpiresByType text/css "access plus 1 week"
|
||||||
|
ExpiresByType text/javascript "access plus 1 month"
|
||||||
|
ExpiresByType text/html "access plus 1 seconds"
|
||||||
|
ExpiresByType application/javascript "access plus 1 month"
|
||||||
|
ExpiresByType application/x-javascript "access plus 1 month"
|
||||||
|
ExpiresByType image/gif "access plus 1 week"
|
||||||
|
ExpiresByType image/jpeg "access plus 1 week"
|
||||||
|
ExpiresByType image/png "access plus 1 week"
|
||||||
|
ExpiresByType image/x-icon "access plus 1 month"
|
||||||
|
ExpiresByType image/svg+xml "access plus 1 week"
|
||||||
|
ExpiresByType application/x-font-woff "access plus 1 week"
|
||||||
|
ExpiresByType application/font-woff2 "access plus 1 week"
|
Loading…
Reference in New Issue