Docker Community Forums

Share and learn in the Docker community.

Is there a script file that can autorun on boot of the Moby VM?


(Tomfrost) #1

Is there a file that can be inserted to the xhyve virtual machine to auto-run on boot/restart? Boot2docker used tmpfs for the root mount just like Moby does, but since /var persisted, it allowed you to place a /var/lib/boot2docker/bootlocal.sh file that would run on boot to allow you to set up custom configurations.

I would love to do something similar with Moby, but can’t find an obvious implementation of that same feature.


(Fulcrum) #2

@tomfrost I don’t have an answer for this, but if there is not a way, you could use a wrapper and similar logic that I used for https://github.com/IFSight/d4m-nfs

ps auxwww|grep docker|grep vmstateevent |grep '"vmstate":"running"' 1>/dev/null 2>/dev/null
CHECK=$?
i=0
while [ $CHECK -eq 1 ]; do
  sleep 1
  echo -n "$i "
  i=$[$i+1]
  ps auxwww|grep docker|grep vmstateevent |grep '"vmstate":"running"' 1>/dev/null 2>/dev/null
  CHECK=$?
done

(Tomfrost) #3

Yeah, my concern is that everything your (and my) script does is ephemeral. After a reboot of the VM, it’s gone. I’d love to have it configure itself on boot just like my boot2docker VM did, rather than write a service that is constantly running on the host to check for restarts.


(Xaviermoon) #4

Trevor !!! OMG!!!