Minimal Alpine image with runit process supervisor
610
runit is an init scheme for Unix-like operating systems that initializes, supervises, and ends processes throughout the operating system.Runit is a reimplementation of the daemontools process supervision toolkit that runs on the Linux, Mac OS X, *BSD, and Solaris operating systems. Runit features parallelization of the start up of system services, which can speed up the boot time of the operating system.
Runit is an init daemon, so it is the direct or indirect ancestor of all other processes. It is the first process started during booting, and continues running until the system is shut down.
(Source : Wikipedia)
This image is built on top of the latest Alpine container and integrate runit as a process supervisor.
This image can easly be used as a replacement of any Alpine which would include supervisor or any other process management.
Add your initialisation scripts in: /etc/runit/init.d
Add your shutdown scripts in: /etc/runit/finish.d
Any services should be placed in: /etc/service.d/ (with run and finish script)
Create the file enable in /etc/service.d/MyService/ to enable the service at startup: touch /etc/service.d/MyService/enable.
Create the file disable in /etc/service.d/MyService/ to disable the service at startup: touch /etc/service.d/MyService/disable.
Disabling a service is predominante over enabling it.
Run it: docker run -it -d --name=runit craftdock/alpine-runit
Get an sh command prompt inside the container and play with your services:
docker exec -it runit sh
# Get help
runit help
# List installed services
runit list
# Enable a service
runit service MyService enable
# Disable a service
runit service MyService disable
# Start a service
runit service MyService start
# Stop a service
runit service MyService stop
# Restart a service
runit service MyService restart
# Status of the service
runit service MyService status
# Stop the container
runit stop
A cron service is included, however it is not enable by default.
To enable if, just create the file enable in /etc/service.d/cron : touch /etc/service.d/cron/enable
Add your cron file into /etc/crontabs and it will automatically be added to /etc/crontabs/root
An example can be found in the example folder.
Have a look at the example folder. You'll find out how to create an image based on craftdock/alpine-runit
This example image contains:
/etc/runit/init.d/00-echo.sh/etc/runit/finish.d/00-echo.sh/etc/runit/service.d/log-service (with run and finish script)/etc/runit/service.d/main-service (with run and finish script)/etc/runit/service.d/test-serviceservice (with run script)/etc/crontabs/echo-testInspired from runitshover and others runit images found on GitHub.
Content type
Image
Digest
Size
4.6 MB
Last updated
over 7 years ago
docker pull craftdock/alpine-runit