Not sure if this is in the documentation, but for others…
/opt/rancher/bin/start.sh <- runs before docker has started
/etc/rc.local <- runs after docker has started - although scripts needs to check docker has finished loading (e.g. check for docker info) if you are requiring use of docker.
My question to the Rancher team is:
Is it possible to set up scripts that can run on termination or reboot of rancherOS?
Ok so currently no. My use case is running rancher with spotinst. When the host gets a shutdown signal, any other os I could put a script in to ping my hip chat. I know rancheros is minimal but might be nice to support some shutdown hook?
You can actually do this today in a way. Create a container that does nothing but wait for SIGTERM. After SIGTERM ping hip chat. On shutdown of rancher os we do stop all system services (must be in system-docker, not user-docker). So your container would shutdown.
I need a way to set some aliases and custom configuration to RancherOS / console. Could you provide such a example executed during boot?
I created a system-docker convoy os-service for example, but need an alias for console usage (convoy binary can’t be bind to the console, so I have to use docker exec …). 91dbadb6ddd4 pwfoo/private:os-convoy-vfs "/convoy-start.sh" 3 days ago Up 9 minutes os_convoy-vfs_1
So something like a config container ( need to know how the convoy container is named) or a /etc/rc.local is needed. alias sysdocker="sudo system-docker" alias convoy="sudo system-docker exec -ti os_convoy-vfs_1 convoy"