A base image to run multi-process containers supervised by s6 (UNMAINTAINED)
978
A base image to run multi-process containers supervised by the lightweight s6 process supervisor.
This image should run normally on docker, but it also does on openshift (arbitrary user id).
Let's say, that you have an application that runs a Java backend and an nginx frontend webserver.
You want to run this application in a single container for whatever reason.
For this to work you need a process supervisor, such as supervisord or s6.
This base image has an ONBUILD command that copies your local s6 folder into the new container
right after you declare FROM ....
s6 in your docker repo.run script that goes into the aforementioned subdirectory.For more detailed s6 instructions, go to https://skarnet.org/software/s6/servicedir.html
This is the nginx run script. It will get copied to /etc/services.d/nginx on the container,
but the ONBUILD instruction will take care of that. The script should never terminate.
# cat s6/nginx/run
#!/bin/sh
echo "${PWD}" # beware that this will be /etc/services.d/nginx, you may want to "cd /..." first.
echo "[s6] Starting: nginx"
exec nginx -g "daemon off;" # be sure to use "exec"
Similarly, here is a sample config for the java file.
# cat s6/java/run
#!/bin/sh
echo "${PWD}"
echo "[s6] Starting: java"
exec java -jar yourapp.jar
By default, s6 will restart the run scripts if they exited. This can be undesired since a container should stop if there are problems. Otherwise a non-working container might not get detected by a sysadmin. In our example, it is fine to restart the nginx server if it crashes, but when tha java process exits, we want to shutdown the container. This can be achieved with a finish script.
# cat s6/java/finish
#!/bin/sh
echo "[s6] Finishing: java"
# do cleanup...
# use this command to shut down the container.
s6-svscanctl -q /etc/services.d
latest: Latest Alpine Linuxalpine-3.7: Alpine 3.7Content type
Image
Digest
Size
3.2 MB
Last updated
over 8 years ago
docker pull braindoctor/s6-openshift