title: cronjob inside docker - can't capture logs
body: <p>I'm trying to run a cronjob inside a docker container, and the logs (created with python <code>logging</code>) from <code>docker logs my_container</code> or from <code>/var/log/cron.log</code>. Neither is working. I tried a bunch of solutions I found in stackoverflow.</p>
  <p>This is my Dockerfile:</p>
  <pre><code>FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
  
  ENV DEBIAN_FRONTEND=noninteractive
  ENV TZ=Europe/Minsk
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &amp;&amp; echo $TZ &gt; /etc/timezone
  
  RUN apt-get update &amp;&amp; apt-get install -y \
          python3-dev \
          python3-tk \
          python3-pip \
          libglib2.0-0\
          libsm6 \
          postgresql-server-dev-all \
          postgresql-common \
          openssh-client \
          libxext6 \
          nano \
          pkg-config \
          rsync \
          cron \
          &amp;&amp; \
      apt-get clean &amp;&amp; \
      apt-get autoremove &amp;&amp; \
      rm -rf /var/lib/apt/lists/*
  RUN pip3 install  --upgrade  setuptools
  RUN pip3 install numpy
  ADD requirements.txt /requirements.txt
  RUN pip3 install -r /requirements.txt &amp;&amp; rm /requirements.txt
  
  RUN touch /var/log/cron.log
  COPY crontab /etc/cron.d/cjob
  RUN chmod 0644 /etc/cron.d/cjob
  
  ENV LC_ALL=C.UTF-8
  ENV LANG=C.UTF-8
  ENV PYTHONUNBUFFERED 1
  
  ADD . /code
  WORKDIR /code
  COPY ssh_config /etc/ssh/ssh_config
  
  CMD cron -f
  
  </code></pre>
  <p>and this is how I run it:</p>
  <pre><code>nvidia-docker run -d \
      -e DISPLAY=unix$DISPLAY \
      -v /tmp/.X11-unix:/tmp/.X11-unix \
      -v /media/storage:/opt/images/ \
      -v /home/user/.aws/:/root/.aws/ \
      --net host \
      my_container
  </code></pre>
  <p>I tried different things such as:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/51399323/docker-ubuntu-cron-tail-logs-not-visible">Docker ubuntu cron tail logs not visible</a></li>
  <li><a href="https://stackoverflow.com/questions/45395390/see-cron-output-via-docker-logs-without-using-an-extra-file">See cron output via docker logs, without using an extra file</a></li>
  </ul>
  <p>But I don't get any logs.</p>