{"id":13423392,"url":"https://github.com/krallin/tini","last_synced_at":"2025-05-13T19:03:03.270Z","repository":{"id":27940016,"uuid":"31432573","full_name":"krallin/tini","owner":"krallin","description":"A tiny but valid `init` for containers","archived":false,"fork":false,"pushed_at":"2025-05-08T14:42:27.000Z","size":245,"stargazers_count":10317,"open_issues_count":37,"forks_count":517,"subscribers_count":109,"default_branch":"master","last_synced_at":"2025-05-08T15:29:24.990Z","etag":null,"topics":["c","docker","init","init-system","linux"],"latest_commit_sha":null,"homepage":"","language":"C","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/krallin.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,"zenodo":null}},"created_at":"2015-02-27T18:13:59.000Z","updated_at":"2025-05-08T14:42:38.000Z","dependencies_parsed_at":"2022-07-12T16:09:20.044Z","dependency_job_id":"c5894234-f3cf-4414-8e72-3d14e5a2efda","html_url":"https://github.com/krallin/tini","commit_stats":{"total_commits":189,"total_committers":26,"mean_commits":7.269230769230769,"dds":"0.20105820105820105","last_synced_commit":"0b44d3665869e46ccbac7414241b8256d6234dc4"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krallin%2Ftini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krallin%2Ftini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krallin%2Ftini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krallin%2Ftini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krallin","download_url":"https://codeload.github.com/krallin/tini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010792,"owners_count":21998993,"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":["c","docker","init","init-system","linux"],"created_at":"2024-07-31T00:00:33.514Z","updated_at":"2025-05-13T19:03:03.262Z","avatar_url":"https://github.com/krallin.png","language":"C","readme":"\u003c!--\n\n#####################################\n# THIS FILE IS AUTOGENERATED!       #\n# Edit ./tpl/README.md.in instead   #\n#####################################\n\n--\u003e\n\n\nTini - A tiny but valid `init` for containers\n=============================================\n\n[![Build Status](https://travis-ci.org/krallin/tini.svg?branch=master)](https://travis-ci.org/krallin/tini)\n\nTini is the simplest `init` you could think of.\n\nAll Tini does is spawn a single child (Tini is meant to be run in a container),\nand wait for it to exit all the while reaping zombies and performing\nsignal forwarding.\n\n\nWhy Tini?\n---------\n\nUsing Tini has several benefits:\n\n- It protects you from software that accidentally creates zombie processes,\n  which can (over time!) starve your entire system for PIDs (and make it\n  unusable).\n- It ensures that the *default signal handlers* work for the software you run\n  in your Docker image. For example, with Tini, `SIGTERM` properly terminates\n  your process even if you didn't explicitly install a signal handler for it.\n- It does so completely transparently! Docker images that work without Tini\n  will work with Tini without any changes.\n\nIf you'd like more detail on why this is useful, review this issue discussion:\n[What is advantage of Tini?][0].\n\n\nUsing Tini\n----------\n\n*NOTE: If you are using Docker 1.13 or greater, Tini is included in Docker\nitself. This includes all versions of Docker CE. To enable Tini, just [pass the\n`--init` flag to `docker run`][5].*\n\n*NOTE: There are [pre-built Docker images available for Tini][10]. If\nyou're currently using an Ubuntu or CentOS image as your base, you can use\none of those as a drop-in replacement.*\n\n*NOTE: There are Tini packages for Alpine Linux and NixOS. See below for\ninstallation instructions.*\n\nAdd Tini to your container, and make it executable. Then, just invoke Tini\nand pass your program and its arguments as arguments to Tini.\n\nIn Docker, you will want to use an entrypoint so you don't have to remember\nto manually invoke Tini:\n\n    # Add Tini\n    ENV TINI_VERSION=v0.19.0\n    ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini\n    RUN chmod +x /tini\n    ENTRYPOINT [\"/tini\", \"--\"]\n\n    # Run your program under Tini\n    CMD [\"/your/program\", \"-and\", \"-its\", \"arguments\"]\n    # or docker run your-image /your/program ...\n\nNote that you *can* skip the `--` under certain conditions, but you might\nas well always include it to be safe. If you see an error message that\nlooks like `tini: invalid option -- 'c'`, then you *need* to add the `--`.\n\nArguments for Tini itself should be passed like `-v` in the following example:\n`/tini -v -- /your/program`.\n\n*NOTE: The binary linked above is a 64-bit dynamically-linked binary.*\n\n\n### Signed binaries ###\n\nThe `tini` and `tini-static` binaries are signed using the key `595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7`.\n\nYou can verify their signatures using `gpg` (which you may install using\nyour package manager):\n\n    ENV TINI_VERSION v0.19.0\n    ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini\n    ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc /tini.asc\n    RUN gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \\\n     \u0026\u0026 gpg --batch --verify /tini.asc /tini\n    RUN chmod +x /tini\n\n\n### Verifying binaries via checksum ###\n\nThe `tini` and `tini-static` binaries have generated checksums (`SHA1` and `SHA256`).\n\nYou can verify their checksums using `sha1sum` and `sha256sum` (which you may install using\nyour package manager):\n\n    ENV TINI_VERSION v0.19.0\n    RUN wget --no-check-certificate --no-cookies --quiet https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-amd64 \\\n        \u0026\u0026 wget --no-check-certificate --no-cookies --quiet https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-amd64.sha256sum \\\n        \u0026\u0026 echo \"$(cat tini-amd64.sha256sum)\" | sha256sum -c\n\n\n### Alpine Linux Package ###\n\nOn Alpine Linux, you can use the following command to install Tini:\n\n    RUN apk add --no-cache tini\n    # Tini is now available at /sbin/tini\n    ENTRYPOINT [\"/sbin/tini\", \"--\"]\n\n\n### NixOS ###\n\nUsing Nix, you can use the following command to install Tini:\n\n    nix-env --install tini\n\n\n### Debian ###\n\nOn Debian (Buster or newer), you can use the following command to install Tini:\n\n    apt-get install tini\n\nNote that this installs `/usr/bin/tini` (and `/usr/bin/tini-static`), not `/tini`.\n\n\n### Arch Linux ###\n\nOn Arch Linux, there is a package available on the [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository).\nInstall using the [official instructions](https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages)\nor use an [AUR helper](https://wiki.archlinux.org/index.php/AUR_helpers):\n\n    pacaur -S tini\n\n\n### Other Platforms ###\n\nARM and 32-bit binaries are available! You can find the complete list of\navailable binaries under [the releases tab][11].\n\n\nOptions\n-------\n\n### Verbosity ###\n\nThe `-v` argument can be used for extra verbose output (you can pass it up to\n3 times, e.g. `-vvv`).\n\n\n### Subreaping ###\n\nBy default, Tini needs to run as PID 1 so that it can reap zombies (by\nrunning as PID 1, zombies get re-parented to Tini).\n\nIf for some reason, you cannot run Tini as PID 1, you should register Tini as\na process subreaper instead (only in Linux \u003e= 3.4), by either:\n\n  + Passing the `-s` argument to Tini (`tini -s -- ...`)\n  + Setting the environment variable `TINI_SUBREAPER`\n    (e.g. `export TINI_SUBREAPER=`).\n\nThis will ensure that zombies get re-parented to Tini despite Tini not running\nas PID 1.\n\n*NOTE: Tini will issue a warning if it detects that it isn't running as PID 1\nand isn't registered as a subreaper. If you don't see a warning, you're fine.*\n\n\n### Remapping exit codes ###\n\nTini will reuse the child's exit code when exiting, but occasionally, this may\nnot be exactly what you want (e.g. if your child exits with 143 after receiving\nSIGTERM). Notably, this can be an issue with Java apps.\n\nIn this case, you can use the `-e` flag to remap an arbitrary exit code to 0.\nYou can pass the flag multiple times if needed.\n\nFor example:\n\n```\ntini -e 143 -- ...\n```\n\n\n### Process group killing ###\n\nBy default, Tini only kills its immediate child process.  This can be\ninconvenient if sending a signal to that process does not have the desired\neffect.  For example, if you do\n\n    docker run --rm krallin/ubuntu-tini sh -c 'sleep 10'\n\nand ctrl-C it, nothing happens: SIGINT is sent to the 'sh' process,\nbut that shell won't react to it while it is waiting for the 'sleep'\nto finish.\n\nYou can configure Tini to kill the child process group, so that every process\nin the group gets the signal, by either:\n\n  + Passing the `-g` argument to Tini (`tini -g -- ...`)\n  + Setting the environment variable `TINI_KILL_PROCESS_GROUP`\n    (e.g. `export TINI_KILL_PROCESS_GROUP=`).\n\nThis corresponds more closely to what happens when you do ctrl-C etc. in a\nterminal: The signal is sent to the foreground process group.\n\n    docker run --rm --entrypoint tini krallin/ubuntu-tini -g -- sh -c 'sleep 10'\n\n### Parent Death Signal ###\n\nTini can set its parent death signal, which is the signal Tini should receive\nwhen *its* parent exits. To set the parent death signal, use the `-p` flag with\nthe name of the signal Tini should receive when its parent exits:\n\n```\ntini -p SIGTERM -- ...\n```\n\n*NOTE: See [this PR discussion][12] to learn more about the parent death signal\nand use cases.*\n\n\nMore\n----\n\n### Existing Entrypoint ###\n\nTini can also be used with an existing entrypoint in your container!\n\nAssuming your entrypoint was `/docker-entrypoint.sh`, then you would use:\n\n    ENTRYPOINT [\"/tini\", \"--\", \"/docker-entrypoint.sh\"]\n\n\n### Statically-Linked Version ###\n\nTini has very few dependencies (it only depends on libc), but if your\ncontainer fails to start, you might want to consider using the statically-built\nversion instead:\n\n    ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini\n\n\n### Size Considerations ###\n\nTini is a very small file (in the 10KB range), so it doesn't add much weight\nto your container.\n\nThe statically-linked version is bigger, but still \u003c 1M.\n\n\nBuilding Tini\n-------------\n\nIf you'd rather not download the binary, you can build Tini by running\n`cmake . \u0026\u0026 make`.\n\nBefore building, you probably also want to run:\n\n    export CFLAGS=\"-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37\"\n\nThis ensure that even if you're building on a system that has old Linux Kernel\nheaders (\u003c 3.4), Tini will be built with child subreaper support. This is\nusually what you want if you're going to use Tini with Docker (if your host\nKernel supports Docker, it should also support child subreapers).\n\n\nUnderstanding Tini\n------------------\n\nAfter spawning your process, Tini will wait for signals and forward those\nto the child process, and periodically reap zombie processes that may be\ncreated within your container.\n\nWhen the \"first\" child process exits (`/your/program` in the examples above),\nTini exits as well, with the exit code of the child process (so you can\ncheck your container's exit code to know whether the child exited\nsuccessfully).\n\n\nDebugging\n---------\n\nIf something isn't working just like you expect, consider increasing the\nverbosity level (up to 3):\n\n    tini -v    -- bash -c 'exit 1'\n    tini -vv   -- true\n    tini -vvv  -- pwd\n\n\nAuthors\n=======\n\nMaintainer:\n\n  + [Thomas Orozco][20]\n\nContributors:\n\n  + [Tianon Gravi][30]\n  + [David Wragg][31]\n  + [Michael Crosby][32]\n  + [Wyatt Preul][33]\n  + [Patrick Steinhardt][34]\n\nSpecial thanks to:\n\n  + [Danilo Bürger][40] for packaging Tini for Alpine\n  + [Asko Soukka][41] for packaging Tini for Nix\n  + [nfnty][42] for packaging Tini for Arch Linux\n\n\n  [0]: https://github.com/krallin/tini/issues/8\n  [5]: https://docs.docker.com/engine/reference/commandline/run/\n  [10]: https://github.com/krallin/tini-images\n  [11]: https://github.com/krallin/tini/releases\n  [12]: https://github.com/krallin/tini/pull/114\n  [20]: https://github.com/krallin/\n  [30]: https://github.com/tianon\n  [31]: https://github.com/dpw\n  [32]: https://github.com/crosbymichael\n  [33]: https://github.com/geek\n  [34]: https://github.com/pks-t\n  [40]: https://github.com/danilobuerger\n  [41]: https://github.com/datakurre\n  [42]: https://github.com/nfnty/pkgbuilds/tree/master/tini/tini\n","funding_links":[],"categories":["C","HarmonyOS","DevOps","Build \u0026 Packaging Automation","Containers","linux","Docker-Tools","OPS"],"sub_categories":["Windows Manager","Container","Threat modelling"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrallin%2Ftini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrallin%2Ftini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrallin%2Ftini/lists"}