Understand s6-overlay Init Stages
masters6-overlay operates through three distinct stages during the container lifecycle:
- Stage 1 (Setup): Configures the image to execute the supervision tree and prepares the environment for Stage 2.
- Stage 2 (Initialization & Service Start):
- Executes legacy oneshot user scripts in
/etc/cont-init.d. - Runs user
s6-rcservices defined in the/etc/s6-overlay/user-bundles.d/userbundle (services are declared in/etc/s6-overlay/s6-rc.d). - Starts legacy longrun services from
/etc/services.d. - Runs user
s6-rcservices defined in the/etc/s6-overlay/user-bundles.d/user2bundle.
- Executes legacy oneshot user scripts in
- Stage 3 (Shutdown):
- Sends
TERMsignals to legacy longrun services and waits for exit. - Brings down
s6-rcservices in an orderly fashion. - Executes finalization scripts in
/etc/cont-finish.d. - Sends
TERMsignals to remaining processes, waits, and finally sendsKILLsignals before exiting.
- Sends