The s6 supervision suite is a collection of tools for managing services in containers. It is used in the apko container building system to manage multiple processes in a container without reaping or signalling issues. The s6 suite is designed to be lightweight, fast, and reliable, making it well-suited for use in container environments.
The s6 suite includes several components, including:
- s6-supervise: a process supervisor that manages the lifecycle of services
- s6-svscan: a service scanner that automatically restarts s6-supervise when it exits
- s6-rc: a service manager that can start, stop, and restart services
Here are some examples of how to use the s6 suite in apko containers:
Using s6-supervise
To use s6-supervise in an apko container, you can include it in your container’s image and then use it to manage a service. For example, you might create a YAML file that looks like this:
services:
myservice:
command: /usr/bin/myservice
user: root
directory: /var/run/myservice
This YAML file defines a service called myservice
that runs the /usr/bin/myservice
command as the root
user in the /var/run/myservice
directory. To use s6-supervise to manage this service, you can include the following command in your container’s entrypoint:
s6-supervise /var/run/myservice
This command will start s6-supervise and tell it to manage the myservice
service.
Using s6-svscan
To use s6-svscan in an apko container, you can include it in your container’s image and then use it to automatically restart s6-supervise when it exits. For example, you might create a YAML file that looks like this:
services:
myservice:
command: /usr/bin/myservice
user: root
directory: /var/run/myservice
svscan:
command: s6-svscan /var/run/s6
directory: /var/run/s6
This YAML file defines a service called myservice
that runs the /usr/bin/myservice
command as the root
user in the /var/run/myservice
directory. It also defines a service called svscan
that runs the s6-svscan
command in the /var/run/s6
directory. When s6-svscan exits, it will automatically be restarted by apko.
Using s6-rc
To use s6-rc in an apko container, you can include it in your container’s image and then use it to start, stop, and restart services. For example, you might create a YAML file that looks like this:
services:
myservice:
command: /usr/bin/myservice
user: root
directory: /var/run/myservice
svscan:
command: s6-svscan /var/run/s6
directory: /var/run/s