More code example in the README

pull/1/head
Thomas Orozco 10 years ago
parent ffb171edf7
commit 8a2e156182
  1. 65
      README.md

@ -11,30 +11,71 @@ signal forwarding.
Using Tini
----------
Add Tini to your container, and make it executable.
Add Tini to your container, and make it executable. Then, just invoke Tini
and pass your program and its arguments as arguments to Tini.
Tini is a very small file (in the 10KB range), and all it depends on is `libc`.
In Docker, you will want to use an entrypoint so you don't have to remember
to manually invoke Tini:
Once you've added Tini, use it like so:
# Add Tini
ENV TINI_VERSION v0.2.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
tini -- your_program and its args
# Run your program under Tini
CMD ["/your/program", "-and", "-its", "arguments"]
# or docker run your-image /your/program ...
Note that you *can* skip the `--` above if your program only accepts
positional arguments, but it's best to get used to using it.
Note that you *can* skip the `--` under certain conditions, but you might
as well always include it to be safe. If you see an error message that
looks like `tini: invalid option -- 'c'`, then you *need* to add the `--`.
If you try to use positional arguments with Tini without using `--`, you'll
get an error similar to:
Arguments Tini itself are passed like so: `/tini -v -- /your/program`.
The only supported argument at this time is `-v`, for extra verbosity (you can
pass it up to 4 times, e.g. `-vvvv`).
./tini: invalid option -- 'c'
*NOTE*: The binary linked above is a 64-bit dynamically-linked binary.
### Existing Entrypoint ###
Tini can also be used with an existing entrypoint in your container!
Assuming your entrypoint was `/docker-entrypoint.sh`, then you would use:
ENTRYPOINT ["/tini", "--", "docker-entrypoint.sh"]
### Statically-Linked Version ###
Tini has very few dependencies (it only depends on libc), but if your
container fails to start, you might want to consider using the statically-built
version instead:
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini
### Size Considerations ###
Tini is a very small file (in the 10KB range), so it doesn't add much weight
to your container.
The statically-linked version is bigger, but still < 1M.
### Building Tini ###
If you'd rather not download the binary, you can build Tini by just running
`make` (i.e. there is no `./configure` script).
Understanding Tini
------------------
After spawning your process, Tini will wait for signals and forward those
to the child process (except for `SIGCHLD` and `SIGKILL`, of course).
Besides, Tini will reap potential zombie processes every second.
to the child process, and periodically reap zombie processes that may be
created within your container.
Debugging

Loading…
Cancel
Save