{"id":15844268,"url":"https://github.com/tekgator/docker-hd-idle","last_synced_at":"2025-03-15T19:32:03.519Z","repository":{"id":53602718,"uuid":"347239617","full_name":"tekgator/docker-hd-idle","owner":"tekgator","description":"Bundle the new Golang hd-idle and the legacy hd-idle application to run in a docker environment","archived":false,"fork":false,"pushed_at":"2022-01-15T05:16:59.000Z","size":40,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-27T04:08:35.788Z","etag":null,"topics":["disks","docker","docker-container","golang","hd-idle","hdd","hdparm","standby","standby-mode"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/tekgator.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":null,"security":null,"support":null}},"created_at":"2021-03-13T01:06:53.000Z","updated_at":"2024-02-06T10:42:25.000Z","dependencies_parsed_at":"2022-09-02T10:50:41.731Z","dependency_job_id":null,"html_url":"https://github.com/tekgator/docker-hd-idle","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekgator%2Fdocker-hd-idle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekgator%2Fdocker-hd-idle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekgator%2Fdocker-hd-idle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekgator%2Fdocker-hd-idle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tekgator","download_url":"https://codeload.github.com/tekgator/docker-hd-idle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243781667,"owners_count":20347123,"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":["disks","docker","docker-container","golang","hd-idle","hdd","hdparm","standby","standby-mode"],"created_at":"2024-10-05T17:21:11.345Z","updated_at":"2025-03-15T19:32:03.184Z","avatar_url":"https://github.com/tekgator.png","language":"Dockerfile","funding_links":["https://www.buymeacoffee.com/tekgator"],"categories":[],"sub_categories":[],"readme":"# docker-hd-idle\n\n\u003cp\u003e\n  \u003ca href=\"https://github.com/tekgator/docker-hd-idle/actions/workflows/build-and-publish.yml\" alt=\"BuildStatus\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/workflow/status/tekgator/docker-hd-idle/Publish%20Docker%20image\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/tekgator/docker-hd-idle\" alt=\"DockerPulls\"\u003e\n    \u003cimg src=\"https://img.shields.io/docker/pulls/tekgator/docker-hd-idle\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/tekgator/docker-hd-idle/tags?page=1\u0026ordering=last_updated\" alt=\"DockerBuildStatus\"\u003e\n    \u003cimg src=\"https://img.shields.io/docker/image-size/tekgator/docker-hd-idle/latest\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/tekgator/docker-hd-idle/blob/main/LICENSE\" alt=\"License\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/tekgator/docker-hd-idle\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/tekgator/docker-hd-idle/releases\" alt=\"Releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/tekgator/docker-hd-idle\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nBundle `hd-idle` application to run in a docker environment.\n\n- Maintained by [Patrick Weiss](https://github.com/tekgator)\n- Problems and issues can be filed on the [Github repository](https://github.com/tekgator/docker-hd-idle/issues)\n\n## buy-me-a-coffee\nLike some of my work? Buy me a coffee ☕ (or more likely a beer 🍺, or even more likly shoes 👠 or purse 👜 for the wify 😄)\n\n\u003ca href=\"https://www.buymeacoffee.com/tekgator\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n\n## Description\n\n`hd-idle` is a utility program for spinning-down external disks after a period of idle time. Since most external IDE disk enclosures don't support setting the IDE idle timer, a program like hd-idle is required to spin down idle disks automatically.\n\nThe goal of this docker image is to make the use of `hd-idle` an easy. The configuration of the application can either be done via environment variables or via a config file in a mounted volume.\n\n## Implementations\n\nThe image implements the 2 available hd-idle versions:\n\n1. The Golang implementation by [Andoni del Olmo](https://github.com/adelolmo). The **[documentation](https://github.com/adelolmo/hd-idle)** and source code can be found on Github repository page.\n\n2. The orignal (legacy) implementation by [Christina Mueller](https://sourceforge.net/u/cjmueller/profile/). The **[documentation](http://hd-idle.sourceforge.net/)** can be found on the Sourceforge page. This version can be used by setting `LEGACY=1` environment variable. \n\nFor any configuartion topics concerning `hd-idle` I recommend visiting either project site.\n\nMany thanks to to both of them for this great tool!\n\n## Supported tags and respective `Dockerfile` links\n\n* [`1.2.2`, `latest`](https://github.com/tekgator/docker-hd-idle/blob/main/Dockerfile):  Golang version 1.13 and legacy version 1.05\n\n* [`dev`](https://github.com/tekgator/docker-hd-idle/blob/main/Dockerfile): Development build\n\n## Word of cautions\n\nIn order to set the disks in stand-by the container needs to be in `privileged` mode and the `/dev` path has to be forwarded to the container. Of course that could be a potential security risk. For me personally, I can live with it in my homelab setup.\n\n## Run\n\n### Basic run command to get things up and running\n\n```bash\ndocker run -d \\\n  --name hd-idle \\\n  --privileged \\\n  -v /dev:/dev \\\n  tekgator/docker-hd-idle:latest\n``` \n\nThis will run the container with default settings, no configuration possible. All Hard drives will spin down after 10 minutes inactivity.\n\n### Configuration option 1: Map to volume\n\n```bash\ndocker run -d \\\n  --name hd-idle \\\n  --privileged \\\n  -v /dev:/dev \\\n  -v /path_to_config/hd-idle:/config \\\n  tekgator/docker-hd-idle:latest\n``` \n\nOn first start of the container it will create a config file in the provided volume. Make adjustments as described in the `hd-idle` **documentation** and restart the container afterwards to apply the changes.\n\n### Configuration option 2: Setting environment variables\n\n```bash\ndocker run -d \\\n  --name hd-idle \\\n  --privileged \\\n  -v /dev:/dev \\\n  -e IDLE_TIME='0' \\ # Optional: set default stand-by for all disks, e.g. 0 for turn off\n  -e DISK_ID1='/dev/disk/by-uuid/994dffb1-96f0-4440-9ee1-4711' \\\n  -e IDLE_TIME1='900' \\ # Optional (default 600s): if disk is idle 900s go into stand-by\n  -e DISK_CMD1='ata' \\ # Optional (default: scsi): which API to use to communicate with the device (not evaluated in legacy version)\n  -e DISK_ID2='/dev/disk/by-uuid/fa376393-91e4-4d9f-8914-4712' \\\n  tekgator/docker-hd-idle:latest\n``` \n\nConfigurations for certain disks can be made by utilizing environment variables. For each disk setting just increase the number on the variable, e.g. if you like to add a third disk to the config just add **DISK_ID3** and so on.\n\nIn this example we are creating the following config:\n- Turn off stand-by for all disks by using `IDLE_TIME='0'`\n- Create a special stand-by rule for `DISK_ID1='/dev/disk/by-uuid/994dffb1-96f0-4440-9ee1-4711'` with stand-by time after 15 minutes by utilizting `IDLE_TIME1='900'`. To set the disk into stand-by the ATA command set is used `DISK_CMD1=ata`.\n- Create a special stand-by rule for `DISK_ID2='/dev/disk/by-uuid/fa376393-91e4-4d9f-8914-4712'` with stand-by time after 10 minutes as default time.\n\n### Configuration option 3: Utilize config file and environment together\n\nJust combine option 1 and 2 togehter. At first start up a config file is created in the mounted volume with the passed environment variables. Afterwards the config file can be adjusted to your needs. As mentioned already the config file will be parsed on container startup.\n\n### Legacy version\n\nIf you like to use the legacy hd-idle version you can achive this by setting the environment variable `LEGACY=1` like so:\n\n```bash\ndocker run -d \\\n  --name hd-idle \\\n  --privileged \\\n  -v /dev:/dev \\\n  -e LEGACY='1' \\\n  tekgator/docker-hd-idle:latest\n``` \n\n**Note:** If you previously utilized the flags `-c` and `-s` from the Golang version it needs to be removed from the config. Otherwise legacy `hd-idle` will not start. But this can also be seen in the log.\n\n## Use with docker-compose\n\nA [sample](docker-compose.yml) docker-compose file can be found within the repository. Also the [test cases](test) are worth a look.\n\n```yml\n  hd-idle:\n    image: tekgator/docker-hd-idle:latest\n    container_name: hd-idle\n    privileged: true\n    environment:\n      # LEGACY: 1    #uncomment to use legacy version of hd-idle\n      IDLE_TIME: 0\n      DISK_ID1: /dev/disk/by-uuid/994dffb1-96f0-4440-9ee1-4711\n      DISK_CMD1: ata\n      IDLE_TIME1: 900\n      DISK_ID2: /dev/disk/by-uuid/fa376393-91e4-4d9f-8914-4712\n    volumes:\n      - /dev:/dev\n      - ./config:/config\n    restart: unless-stopped\n``` \n\n## Additional info\n\n* Shell access whilst the container is running: `docker exec -it hd-idle /bin/bash`\n* To monitor the logs of the container in realtime: `docker logs -f hd-idle`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekgator%2Fdocker-hd-idle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftekgator%2Fdocker-hd-idle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekgator%2Fdocker-hd-idle/lists"}