title: Enable crond in an Alpine container
body: <h2>Context</h2>
  <p>I'm trying to <strong>schedule</strong> some ingestion jobs in an <strong>Alpine</strong> container. It took  me a while to understand why <em>my <strong>cron jobs</strong> did not start</em>: crond doesn't seems to be running</p>
  <pre><code>rc-service -l | grep crond 
  </code></pre>
  <p>According to <a href="https://wiki.alpinelinux.org/wiki/Alpine_Linux:FAQ#My_cron_jobs_don.27t_run.3F" rel="noreferrer">Alpine's documentation</a>, crond must first be started with <code>openrc</code> (i.e. some kind of <code>systemctl</code>). Here is the  Dockerfile</p>
  <pre><code>FROM python:3.7-alpine
  
  # set work directory
  WORKDIR /usr/src/collector
  
  RUN apk update \
      &amp;&amp; apk add curl openrc
  
  # ======&gt;&gt;&gt;&gt; HERE !!!!! 
  RUN rc-service crond start &amp;&amp; rc-update add crond
  
  # install dependencies
  RUN pip install --upgrade pip
  RUN pip install pipenv
  COPY ./Pipfile /usr/src/collector/Pipfile
  RUN pipenv install --skip-lock --system --dev
  
  # copy entrypoint.sh
  COPY ./entrypoint.sh /usr/src/collector/entrypoint.sh
  
  # copy project
  COPY . /usr/src/collector/
  
  # run entrypoint.sh
  ENTRYPOINT [&quot;/usr/src/collector/entrypoint.sh&quot;]
  </code></pre>
  <p><code>entrypoint.sh</code> merely appends the jobs at the end of <code>/etc/crontabs/root</code></p>
  <h2>Problem</h2>
  <p>I'm getting the following error:</p>
  <pre><code> * rc-service: service `crond' does not exist
  ERROR: Service 'collector' failed to build: The command '/bin/sh -c rc-service crond start &amp;&amp; rc-update add crond' returned a non-zero code: 1
  </code></pre>
  <p>Things are starting to feel a bit circular. How can rc-service not recognizing a service while, in the same time:</p>
  <ul>
  <li><p><code>sh</code> seems to know the name <code>crond</code>,</p>
  </li>
  <li><p>there was a <code>/etc/crontabs/root</code></p>
  </li>
  </ul>
  <p>What am I missing?</p>