cinit is a minimal and correctly functioning init (PID 1) for Docker Containers running in Swarm clusters.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
James Mills b9769edac9
Remove Github workflows
3 months ago
.chglog Fix import paths 3 months ago
example Fix import paths 3 months ago
tools Add project CI and Release tooling 4 months ago
.gitignore Release binaries directly instead of archives 4 months ago
.goreleaser.yml Release binaries directly instead of archives 4 months ago
CHANGELOG.md Fix import paths 3 months ago
Dockerfile Iniitl Commit 4 months ago
LICENSE Add README and LICENSE 4 months ago
Makefile Add project CI and Release tooling 4 months ago
README.md Fix import paths 3 months ago
_config.yml Set theme jekyll-theme-architect 4 months ago
go.mod Fix import paths 3 months ago
go.sum Add support for pty(s) 4 months ago
main.go Add support for pty(s) 4 months ago
version.go Iniitl Commit 4 months ago

README.md

cinit

GitHub All Releases Go Report Card codebeat badge

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)

Usage

See example for a full working example of embedding the cinit 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 Dockerfile:

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:

ENTRYPOINT ["/cinit"]

Your 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 in /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) cinit also supports terminals and automatically detects if being run with a connected TTY. Example:

docker run -i -t test-cinit /bin/sh`

Prior Art

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

License

cinit is licensed under the terms of the MIT License