title: Cron does not run in a PHP Docker container
body: <p>I am using the <code>php:7.4-fpm</code> Docker image and I'm trying to set up cron to run but it's not running.</p>
  <p><strong>Here is my Dockerfile:</strong></p>
  <pre><code>FROM php:7.4-fpm
  
  # Set working directory
  WORKDIR /var/www
  
  # Install dependencies
  RUN apt-get update &amp;&amp; apt-get install -y \
      cron \
      build-essential \
      libpng-dev \
      libjpeg62-turbo-dev \
      libfreetype6-dev \
      locales \
      libzip-dev \
      libmcrypt-dev \
      libonig-dev \
      zlib1g-dev \
      zip \
      jpegoptim optipng pngquant gifsicle \
      vim \
      unzip \
      git \
      graphviz \
      curl \
      supervisor
  
  # Install Imagick
  RUN apt-get update &amp;&amp; \
      apt-get install -y libmagickwand-dev --no-install-recommends &amp;&amp; \
      pecl install imagick &amp;&amp; \
      docker-php-ext-enable imagick
  
  # Clear cache
  RUN apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  # Install extensions
  RUN docker-php-ext-install pdo_mysql zip exif pcntl
  
  # Permissions for Laravel
  RUN chown -R www-data:www-data /var/www
  RUN chmod -R 777 /var/www
  
  # Copy crontab file to the cron.d directory
  COPY ./docker/php-server/crontab /etc/cron.d/crontab
  
  # Give execution rights on the cron job
  RUN chmod 0644 /etc/cron.d/crontab
  
  # Apply cron job
  RUN crontab /etc/cron.d/crontab
  
  # Create the log file to be able to run tail
  RUN touch /var/log/cron.log
  
  EXPOSE 9000
  
  CMD bash -c &quot;cron &amp;&amp; php-fpm&quot;
  </code></pre>
  <p>When I enter the container and check the contents of <code>/etc/cron.d/crontab</code> it is correct</p>
  <pre><code>* * * * * php /var/www/artisan schedule:run &gt;&gt; /var/log/cron.log 2&gt;&amp;1
  # An empty line
  </code></pre>
  <p>But it's not being run. I'm not sure what's going on here..</p>
  <p>When I run <code>service cron status</code> it says <code>[ ok ] cron is running.</code> But nothing is happening.</p>