||1 year ago|
|.chglog||1 year ago|
|example||1 year ago|
|tools||1 year ago|
|.gitignore||1 year ago|
|.goreleaser.yml||1 year ago|
|CHANGELOG.md||1 year ago|
|Dockerfile||1 year ago|
|LICENSE||1 year ago|
|Makefile||1 year ago|
|README.md||1 year ago|
|_config.yml||1 year ago|
|go.mod||1 year ago|
|go.sum||1 year ago|
|main.go||1 year ago|
|version.go||1 year ago|
cinit is a minimal and correctly functioning init (PID 1) for Docker
Containers running in Swarm clusters that supports the following features:
- Reading secrets from Swarm (
/run/secrets) and injecting them as env vars.
- Optional pre and post hooks (TBD)
See example for a full working example of embedding the
binary into your
Dockerfiel and an example contrived service you would
deploy to a Swarm cluster with
docker stack deploy ....
Simply add the
cinit binary to your
FROM alpine:latest ADD https://git.mills.io/prologic/cinit/releases/download/0.0.2/cinit_0.0.2_Linux_x86_64 /cinit RUN chmod 755 /cinit
And ensure that
/cinit is the entrypoint of your image:
CMD is your normal process to be started. When you deploy your service
to a Swarm cluster, any secrets defined for the service and normally available
/run/secrets of the running container(s) are injected as environment
variables before running your process.
- Your process is "supervised" and zombie processes reaped.
- All signals are forwarded to your process as expected.
As a bonus (mostly for interactive and development purposes)
supports terminals and automatically detects if being run with a connected
docker run -i -t test-cinit /bin/sh`
This is inspired by other similar projects:
- envconsul Launch a subprocess with environment variables using data from @hashicorp Consul and Vault.
- dinit An init for use inside Docker containers
- go-init A minimal init system for containers with pre/post hooks
- init Correct init process for Docker containers
cinit is licensed under the terms of the MIT License