{"id":18254095,"url":"https://github.com/testcontainers/moby-ryuk","last_synced_at":"2025-04-05T11:12:32.268Z","repository":{"id":45255446,"uuid":"117447401","full_name":"testcontainers/moby-ryuk","owner":"testcontainers","description":"Schedule Moby/Docker containers cleanup after specific delay.","archived":false,"fork":false,"pushed_at":"2024-05-18T16:16:41.000Z","size":195,"stargazers_count":171,"open_issues_count":13,"forks_count":32,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-05-22T18:21:14.103Z","etag":null,"topics":["automation","docker","go","golang","hacktoberfest","testcontainers","testing"],"latest_commit_sha":null,"homepage":"https://www.testcontainers.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/testcontainers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":"supported-architectures.txt","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-14T16:36:23.000Z","updated_at":"2024-05-28T18:23:07.258Z","dependencies_parsed_at":"2023-02-17T21:31:21.281Z","dependency_job_id":"1e9cb89e-9e43-4a5d-a45c-fb874d6d16fc","html_url":"https://github.com/testcontainers/moby-ryuk","commit_stats":{"total_commits":81,"total_committers":19,"mean_commits":"4.2631578947368425","dds":0.6666666666666667,"last_synced_commit":"2c469e6792c69398966a96e9bb818436efa15c88"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testcontainers%2Fmoby-ryuk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testcontainers%2Fmoby-ryuk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testcontainers%2Fmoby-ryuk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testcontainers%2Fmoby-ryuk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/testcontainers","download_url":"https://codeload.github.com/testcontainers/moby-ryuk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325694,"owners_count":20920714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","docker","go","golang","hacktoberfest","testcontainers","testing"],"created_at":"2024-11-05T10:10:24.015Z","updated_at":"2025-04-05T11:12:32.094Z","avatar_url":"https://github.com/testcontainers.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moby Ryuk\n\nThis project helps you to remove containers, networks, volumes and images by given filter after specified delay.\n\n## Building\n\nTo build the binary only run:\n\n```shell\ngo build\n```\n\nTo build the Linux docker container as the latest tag:\n\n```shell\ndocker build -f linux/Dockerfile -t testcontainers/ryuk:latest .\n```\n\n## Usage\n\nTo start it using the default settings:\n\n```shell\ndocker run -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 testcontainers/ryuk:latest\n```\n\nIf you want to test local changes with the default settings:\n\n```shell\ngo run .\n```\n\nYou can then simulate a connection from testcontainer container using:\n\n```shell\nnc -N localhost 8080 \u003c\u003c EOF\nlabel=testing=true\u0026label=testing.sessionid=mysession\nlabel=something\nEOF\n```\n\nYou can send additional session information for monitoring using:\n\n```shell\nprintf \"label=something_else\" | nc -N localhost 8080\n```\n\nIn the ryuk window you'll see containers/networks/volumes deleted after 10s\n\n```log\ntime=2024-09-30T19:42:30.000+01:00 level=INFO msg=starting connection_timeout=1m0s reconnection_timeout=10s request_timeout=10s shutdown_timeout=10m0s remove_retries=10 retry_offset=-1s changes_retry_interval=1s port=8080 verbose=false\ntime=2024-09-30T19:42:30.001+01:00 level=INFO msg=\"Started\"\ntime=2024-09-30T19:42:30.001+01:00 level=INFO msg=\"client processing started\"\ntime=2024-09-30T19:42:38.002+01:00 level=INFO msg=\"client connected\" address=127.0.0.1:56432 clients=1\ntime=2024-09-30T19:42:38.002+01:00 level=INFO msg=\"adding filter\" type=label values=\"[testing=true testing.sessionid=mysession]\"\ntime=2024-09-30T19:42:38.002+01:00 level=INFO msg=\"adding filter\" type=label values=[something]\ntime=2024-09-30T19:42:38.002+01:00 level=INFO msg=\"client disconnected\" address=127.0.0.1:56432 clients=0\ntime=2024-09-30T19:42:42.047+01:00 level=INFO msg=\"adding filter\" type=label values=[something_else]\ntime=2024-09-30T19:42:42.047+01:00 level=INFO msg=\"client connected\" address=127.0.0.1:56434 clients=1\ntime=2024-09-30T19:42:42.047+01:00 level=INFO msg=\"client disconnected\" address=127.0.0.1:56434 clients=0\ntime=2024-09-30T19:42:52.051+01:00 level=INFO msg=\"prune check\" clients=0\ntime=2024-09-30T19:42:52.216+01:00 level=INFO msg=\"client processing stopped\"\ntime=2024-09-30T19:42:52.216+01:00 level=INFO msg=removed containers=0 networks=0 volumes=0 images=0\ntime=2024-09-30T19:42:52.216+01:00 level=INFO msg=done\n```\n\n## Ryuk configuration\n\nThe following environment variables can be configured to change the behaviour:\n\n| Environment Variable          | Default | Format  | Description  |\n| ----------------------------- | ------- | ------- | ------------ |\n| `RYUK_CONNECTION_TIMEOUT`     | `60s`   | [Duration](https://golang.org/pkg/time/#ParseDuration) | The duration without receiving any connections which will trigger a shutdown |\n| `RYUK_PORT`                   | `8080`  | `uint16` | The port to listen on for connections |\n| `RYUK_RECONNECTION_TIMEOUT`   | `10s`   | [Duration](https://golang.org/pkg/time/#ParseDuration) | The duration after the last connection closes which will trigger resource clean up and shutdown |\n| `RYUK_REQUEST_TIMEOUT`        | `10s`   | [Duration](https://golang.org/pkg/time/#ParseDuration) | The timeout for any Docker requests |\n| `RYUK_REMOVE_RETRIES`         | `10`    | `int` | The number of times to retry removing a resource |\n| `RYUK_RETRY_OFFSET`           | `-1s`   | [Duration](https://golang.org/pkg/time/#ParseDuration) | The offset added to the start time of the prune pass that is used as the minimum resource creation time. Any resource created after this calculated time will trigger a retry to ensure in use resources are not removed |\n| `RYUK_CHANGES_RETRY_INTERVAL` | `1s`    | [Duration](https://golang.org/pkg/time/#ParseDuration) | The internal between retries if resource changes (containers, networks, images, and volumes) are detected while pruning |\n| `RYUK_VERBOSE`                | `false` | `bool` | Whether to enable verbose aka debug logging |\n| `RYUK_SHUTDOWN_TIMEOUT`       | `10m`   | [Duration](https://golang.org/pkg/time/#ParseDuration) | The duration after shutdown has been requested when the remaining connections are ignored and prune checks start |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestcontainers%2Fmoby-ryuk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftestcontainers%2Fmoby-ryuk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestcontainers%2Fmoby-ryuk/lists"}