Skip to main content

Keeps Docker resources in shape based on rules and usage

Project description

Docker Shaper

This is a spin-off package for the docker-shaper tool, which can be used to monitor Docker stuff like containers, images and volumes and automatically enforce certain cleanup-rules.

Installation

[<PYTHON> -m] pip[3] install [--user] [--upgrade] docker-shaper

Usage

docker-shaper serve`

=> Navigate to e.g. http://my-build-node:5432/

Development & Contribution

Prerequisites

  • Python 3.8.10+ (e.g. via pyenv)
  • poetry and pre-commit python3 -m pip install --upgrade --user poetry pre-commit
git clone https://github.com/Checkmk/checkmk-dev-tools
cd checkmk-dev-tools/additional_packages/docker_shaper
pre-commit install
# if you need a specific version of Python inside your dev environment
poetry env use ~/.pyenv/versions/3.8.10/bin/python3
poetry install

Workflow

  • (once and only for publishing to PyPi) Get token on PyPi.org
  • (maybe) setup distinct repository setup poetry config repositories.checkmk https://upload.pypi.org/legacy/
  • (once and only for publishing to PyPi) poetry config pypi-token.checkmk pypi-<LONG-STRING> (will write to ~/.config/pypoetry/auth.toml)
  • modify and check commits via pre-commit
  • after work is done locally:
    • adapt version in pyproject.toml
    • build and check a package
poetry build && \
twine check dist/* &&
python3 -m pip uninstall -y checkmk_dev_tools && \
python3 -m pip install --user dist/checkmk_dev_tools-$(grep -E "^version.?=" pyproject.toml | cut -d '"' -f 2)-py3-none-any.whl
  • check installed package
  • go through review process
  • publish the new package poetry publish --build --repository checkmk
  • commit new version && push

Todo

  • installable via pip install
  • Quart interface (instead of flask)
  • auto-apply changes to source and configuration files
  • outsourced config file
  • bring in features of former dgcd
  • bring in features of former dockermon
  • untag certain tags
  • container cleanup
  • Fix none image lookup
  • Exceptions to messages
  • Clip
  • Increase/decrease logging via web / signal
  • Link: cleanup (images/containers) now
  • Add volumes list (with recent owners)
  • Warn about use of unpinned images
  • Handle 'build cache objects' (found on system prune)
  • Bring in volume monitoring: which volumes have been created and used by which containers?
  • Containers: Store CPU / Memory usage over time
  • Containers: show total CPU usage
  • Containers: list volumes
  • Containers: list parents / children
  • Containers: store history
  • Volumes: list usage
  • Persist messages
  • Instructions to readme
  • List unmatched / overmatched tags
  • Links to delete / remove
  • Links to jobs
  • Link: inspect
  • Graph: cpu / containers (idle/up)
  • Authenticate (at least if we can modify behavior, like stopping/removing images/containers)

Knowledge

(just misc links to articles that helped me out)

Logging

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docker_shaper-0.1.18.tar.gz (161.4 kB view hashes)

Uploaded Source

Built Distribution

docker_shaper-0.1.18-py3-none-any.whl (168.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page