Skip to content

docker-suite/alpine-runit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alpine-runit

Build Status Docker Pulls Docker Stars MicroBadger Layers (tag) MicroBadger Size (tag) License: MIT dockeri.co

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)

What's in this image

This image is built on top of dsuite/alpine-base container and integrate runit as a process supervisor.

This image can easily be used as a replacement of any Alpine image which would include supervisor or any other process management.

Environment variables

A full list of dsuite/alpine-base environment variables are described in the alpine-base Readme.

Change the current user, set the timezone, use your own startup scripts, ... and much more.

How to use it

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 dsuite/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

An example

Have a look at the example folder. You'll find out how to create an image based on dsuite/alpine-runit

This example image contains:

  • An initialisation scripts: /etc/runit/init.d/00-echo.sh
  • A shutdown scripts: /etc/runit/finish.d/00-echo.sh
  • A service named log-service: /etc/runit/service.d/log-service (with run and finish script)
  • A service named main-service: /etc/runit/service.d/main-service (with run and finish script)
  • A service named test-service: /etc/runit/service.d/test-serviceservice (with run script)

Credits

Inspired from runitshover and others runit images found on GitHub.