{"id":13590673,"url":"https://github.com/vmorganp/Lazytainer","last_synced_at":"2025-04-08T14:31:30.621Z","repository":{"id":50524953,"uuid":"416584454","full_name":"vmorganp/Lazytainer","owner":"vmorganp","description":"Docker container lazy loading ","archived":false,"fork":false,"pushed_at":"2025-04-01T00:21:01.000Z","size":1740,"stargazers_count":624,"open_issues_count":7,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-07T16:08:57.618Z","etag":null,"topics":["container","container-image","docker","docker-compose","docker-container","dockerfile","energy-efficiency","go","golang","greenit","hacktoberfest","hacktoberfest2021","lazy","lazy-loading","lazyload","self-hosted","sustainability"],"latest_commit_sha":null,"homepage":"","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/vmorganp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.buymeacoffee.com/vmorganp"}},"created_at":"2021-10-13T04:08:32.000Z","updated_at":"2025-04-04T07:05:35.000Z","dependencies_parsed_at":"2024-02-02T07:25:50.029Z","dependency_job_id":"470c9839-7ba4-4ff4-b31a-29326ee8e2ea","html_url":"https://github.com/vmorganp/Lazytainer","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmorganp%2FLazytainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmorganp%2FLazytainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmorganp%2FLazytainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmorganp%2FLazytainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmorganp","download_url":"https://codeload.github.com/vmorganp/Lazytainer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247860642,"owners_count":21008325,"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":["container","container-image","docker","docker-compose","docker-container","dockerfile","energy-efficiency","go","golang","greenit","hacktoberfest","hacktoberfest2021","lazy","lazy-loading","lazyload","self-hosted","sustainability"],"created_at":"2024-08-01T16:00:49.370Z","updated_at":"2025-04-08T14:31:30.585Z","avatar_url":"https://github.com/vmorganp.png","language":"Go","funding_links":["https://www.buymeacoffee.com/vmorganp"],"categories":["Go"],"sub_categories":[],"readme":"# Lazytainer - Lazy Load Containers\n\nPutting your containers to sleep\n[![Docker Release](https://github.com/vmorganp/Lazytainer/actions/workflows/release.yml/badge.svg)](https://github.com/vmorganp/Lazytainer/actions/workflows/release.yml)\n\n---\n\nhttps://github.com/vmorganp/Lazytainer/assets/31448722/91af5528-6fee-4837-b4d8-11c03e792e94\n\n## Quick Explanation\n\nMonitors network traffic to containers. If there is traffic, the container runs, otherwise the container is stopped/paused. for more details check out the [Configuration](##Configuration) section.\n\n## Want to test it?\n\n1. Clone the project\n   ```\n   git clone https://github.com/vmorganp/Lazytainer\n   cd Lazytainer\n   ```\n2. Start the stack\n   ```sh\n   # if \"docker compose\" doesn't work, try \"docker-compose\"\n   docker compose up\n   ```\n   This will create 2 containers that you can reach through a third \"lazytainer\" container\n3. View the running container by navigating to its web ui at `http://localhost:81`. You should see some information about the container\n4. Close the tab and wait until the logs say \"stopped container\"\n5. Navigate again to `http://localhost:81`, it should be a dead page\n6. Navigate to `http://localhost:81` several times, enough to generate some network traffic, and it should start\n7. To clean up, run\n   ```sh\n   docker-compose down\n   ```\n\n## Configuration\n\n### Note:\n\nLazytainer does not \"automatically\" start and stop all of your containers. You must apply a label to them and proxy their traffic through the Lazytainer container.\n\n### Examples\n\nFor examples of lazytainer in action, check out the [Examples](./examples/)\n\n### Groups\n\nLazytainer starts and stops other containers in \"groups\" of one or more other containers. To assign a container to a lazytainer group, a label must be added. The label will look like this.\n\n```yaml\nyourContainerThatWillSleep:\n  # ... configuration omitted for brevity\n  labels:\n    - \"lazytainer.group=\u003cyourGroupName\u003e\"\n```\n\nTo configure a group, add labels to the lazytainer container like this. Note that each is required to have a port(s) specified. These ports must also be forwarded on the lazytainer container\n\n```yaml\nlazytainer:\n  # ... configuration omitted for brevity\n  ports:\n    - 81:81 # used by group1 and group2\n    - 82:82 # used by group2\n  labels:\n    # Configuration items are formatted like this\n    - \"lazytainer.group.\u003cyourGroupName\u003e.\u003cproperty\u003e=value\"\n    # configuration for group 1\n    - \"lazytainer.group.group1.ports=81\"\n    # configuration for group 2\n    - \"lazytainer.group.group2.ports=81,82\"\n```\n\nGroup properties that can be changed include:\n\n| Name                | description                                                                                                                                                                                        | required | default |\n| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |\n| ports               | Network ports associated with a group, can be comma separated. Should be the INTERNAL port, not the EXPOSED port. ex: service running on `8080` but exposed on `80` should have port set to `8080` | Yes      | n/a     |\n| inactiveTimeout     | Time (seconds) before container is stopped when there is insufficient network activity                                                                                                             | No       | 30      |\n| minPacketThreshold  | Minimum count of network packets for container to be on                                                                                                                                            | No       | 30      |\n| ignoreActiveClients | Determine container activity based on only packet count, ignoring connected client count.                                                                                                          | No       | false   |\n| pollRate            | How frequently (seconds) to check network activity                                                                                                                                                 | No       | 30      |\n| sleepMethod         | How to put the container to sleep. Can be `stop` or `pause`                                                                                                                                        | No       | `stop`  |\n| netInterface        | Network interface to listen on                                                                                                                                                                     | No       | `eth0`  |\n\n### Additional Configuration\n\n#### Verbose Logging\n\nFor more verbose logging, you can apply the environment variable `VERBOSE=true` to lazytainer:\n\n```yaml\nlazytainer:\n  # ... configuration omitted for brevity\n  environment:\n    - VERBOSE=true\n```\n\n#### ipv4/ipv6 toggles\n\nTo disable ipv4 or ipv6, pass environment variables:\n\n```yaml\nlazytainer:\n  # ... configuration omitted for brevity\n  environment:\n    - IPV6_DISABLED=true\n    - IPV4_DISABLED=true\n```\n\n#### Volumes\n\nIf using lazytainer, you MUST provide the following volume to lazytainer\n\n```yaml\nlazytainer:\n  # ... configuration omitted for brevity\n  volumes:\n    - /var/run/docker.sock:/var/run/docker.sock:ro\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmorganp%2FLazytainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmorganp%2FLazytainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmorganp%2FLazytainer/lists"}