I'd like to add hooks into an openrc startup script for sidecar <http://ispyker.blogspot.com.au/2014/08/a-netflixoss-sidecar-in-support-of-non.html> type functionality, ie service discovery registration, but not exactly sure the best way to do it. The problem seems to happen often enough that i'd welcome some feedback on it. Preferably openrc, but s6 experience appreciated. For example;
To add service discovery to the starting of some init.d service, eg lets say a docker container, the container starts every time as a result of running */etc/init.d/docker start*, and as a consequence of being created with: --restart=always With above flag, the container will automatically start as part of the standard docker init script, "/etc/init.d/docker start". But in my case, the container does not natively register itself with consul (or could be any other service discovery system). I know that I can run another container to do the job of registering the container into the service discovery system, but interested in any alternative *within the init system*, ie using openrc script? Might it as a *post-hook*, or as an extra file in some *conf.d* place? I could hack together something, ie using a piece of code like "curl .../register/myservice", but prefer to hear other peoples experience/knowledge on how/where this may be done. Cheers