{"id":22173171,"url":"https://github.com/knutkirkhorn/docker-container-status-notifier","last_synced_at":"2025-03-24T17:45:16.430Z","repository":{"id":42486762,"uuid":"243092984","full_name":"knutkirkhorn/docker-container-status-notifier","owner":"knutkirkhorn","description":"🐳⏰ Notifier for Docker container statuses","archived":false,"fork":false,"pushed_at":"2023-05-03T23:06:02.000Z","size":268,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T22:32:46.403Z","etag":null,"topics":["docker","docker-container","docker-image","nodejs","notification","notifier","status"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/knutkirkhorn.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-25T20:13:16.000Z","updated_at":"2025-01-28T16:33:49.000Z","dependencies_parsed_at":"2024-12-02T07:41:29.828Z","dependency_job_id":null,"html_url":"https://github.com/knutkirkhorn/docker-container-status-notifier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutkirkhorn%2Fdocker-container-status-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutkirkhorn%2Fdocker-container-status-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutkirkhorn%2Fdocker-container-status-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutkirkhorn%2Fdocker-container-status-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knutkirkhorn","download_url":"https://codeload.github.com/knutkirkhorn/docker-container-status-notifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245320372,"owners_count":20596165,"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":["docker","docker-container","docker-image","nodejs","notification","notifier","status"],"created_at":"2024-12-02T07:30:53.813Z","updated_at":"2025-03-24T17:45:16.405Z","avatar_url":"https://github.com/knutkirkhorn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-container-status-notifier\n\n\u003e 🐳⏰ Notifier for Docker container statuses\n\n[![Docker Pulls](https://img.shields.io/docker/pulls/knutkirkhorn/docker-container-status-notifier)](https://hub.docker.com/r/knutkirkhorn/docker-container-status-notifier) [![Docker Image Size](https://badgen.net/docker/size/knutkirkhorn/docker-container-status-notifier)](https://hub.docker.com/r/knutkirkhorn/docker-container-status-notifier)\n\nNotify for changes in Docker container statuses. Notify to a Discord channel using [Discord Webhooks](https://discordapp.com/developers/docs/resources/webhook).\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"https://raw.githubusercontent.com/knutkirkhorn/docker-container-status-notifier/main/media/top-image.png\" alt=\"Container status notification example\"\u003e\n\t\u003cp\u003eSee \u003ca href=\"https://github.com/knutkirkhorn/docker-container-status-notifier#Screenshots\"\u003escreenshots\u003c/a\u003e for more example images.\u003c/p\u003e\n\u003c/div\u003e\n\n## Usage\n\n### Within a Docker container\n\nIt is possible to run this code inside a Docker container by passing the volume (`-v`) flag with the `run` command. This will pass the Docker daemon socket from the host to the container and enable calls to the [Docker Engine API](https://docs.docker.com/engine/api/latest). In this code the API is called using the [dockerode](https://github.com/apocas/dockerode) module by checking for updates in the stream to the [Events API](https://docs.docker.com/engine/api/v1.40/#operation/SystemEvents).\n\n#### From Docker Hub Image\n\nThis will pull the image from [Docker Hub](https://hub.docker.com/) and run the image with the provided configuration for web hooks as below. One can provide only the Webhook URL or both the Webhook ID and token.\n\n```sh\n# Providing Discord Webhook URL\ndocker run -d -v /var/run/docker.sock:/var/run/docker.sock \\\n    -e DISCORD_WEBHOOK_URL=\u003cURL_HERE\u003e \\\n    knutkirkhorn/docker-container-status-notifier\n\n# Providing both Discord Webhook ID and token\ndocker run -d -v /var/run/docker.sock:/var/run/docker.sock \\\n    -e DISCORD_WEBHOOK_ID=\u003cID_HERE\u003e \\\n    -e DISCORD_WEBHOOK_TOKEN=\u003cTOKEN_HERE\u003e \\\n    knutkirkhorn/docker-container-status-notifier\n```\n\n#### From source code\n\n```sh\n# Build container from source\ndocker build -t docker-container-status-notifier .\n\n# Run the built container\ndocker run -d -v /var/run/docker.sock:/var/run/docker.sock \\\n    -e DISCORD_WEBHOOK_URL=\u003cURL_HERE\u003e \\\n    docker-container-status-notifier\n```\n\n### Outside of a Docker container\n\n```sh\n# Install\nnpm install\n\n# Run\nnpm start\n```\n\n### Environment variables\n\nProvide these with the docker run command or store these in a `.env` file. Only `DISCORD_WEBHOOK_URL` or both `DISCORD_WEBHOOK_ID` and `DISCORD_WEBHOOK_TOKEN` are required.\n\n- `DISCORD_WEBHOOK_URL`\n    - URL to the Discord Webhook containing both the ID and the token\n    - Format: `DISCORD_WEBHOOK_URL=https://discordapp.com/api/webhooks/\u003cID_HERE\u003e/\u003cTOKEN_HERE\u003e`\n- `DISCORD_WEBHOOK_ID`\n    - ID for the Discord Webhook\n- `DISCORD_WEBHOOK_TOKEN`\n    - Token for the Discord Webhook\n\n## Screenshots\n\n![Container created](https://raw.githubusercontent.com/knutkirkhorn/docker-container-status-notifier/main/media/container-created.png)\n![Container started](https://raw.githubusercontent.com/knutkirkhorn/docker-container-status-notifier/main/media/container-started.png)\n![Container stopped](https://raw.githubusercontent.com/knutkirkhorn/docker-container-status-notifier/main/media/container-stopped.png)\n![Container killed](https://raw.githubusercontent.com/knutkirkhorn/docker-container-status-notifier/main/media/container-killed.png)\n![Container removed](https://raw.githubusercontent.com/knutkirkhorn/docker-container-status-notifier/main/media/container-removed.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutkirkhorn%2Fdocker-container-status-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknutkirkhorn%2Fdocker-container-status-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutkirkhorn%2Fdocker-container-status-notifier/lists"}