title: How can I auto-start a service in Docker using OpenRC (Alpine)?
body: <p>I'm using an Alpine flavor from iron.io.  I want to auto-run a trivial 'blink' script as a service when the Docker image starts. (I want derivative images that use this as a base to not know/care about this service--it'd just be "inherited" and run.)  I was using S6 for this, and that works well, but wanted to see if something already built into Alpine would work out-of-the-box.</p>
  
  <p>My Dockerfile:</p>
  
  <pre><code>FROM iron/scala
  ADD blinkin /bin/
  ADD blink /etc/init.d/
  RUN rc-update add blink default
  </code></pre>
  
  <p>And my service script:</p>
  
  <pre><code>#!/sbin/openrc-run
  
  command="/bin/blinkin"
  
  depend()
  {
      need localmount
  }
  </code></pre>
  
  <p>The /bin/blinkin script:</p>
  
  <pre><code>#!/bin/bash
  
  for I in $(seq 1 5);
  do
      echo "BLINK!"
      sleep 1
  done
  </code></pre>
  
  <p>So I build the Docker image and run it.  I see no output (BLINK!...)  My script is in /bin and I can run it, and that works.  My blink script is in /etc/init.d and symlinked to /etc/runlevels/default.  So everything <em>looks</em> ok, but it doesn't seem as anything has run.</p>
  
  <p>If I try: 'rc-service blink start' I see no "BLINK!" outbut, but do get this:</p>
  
  <pre><code> * WARNING: blink is already starting
  </code></pre>
  
  <p>What am I doing wrong?</p>