title: Can't clear Laravel cache when using multiple Docker containers
body: <p>I am unable to refresh the Laravel cache and I think the problem could be related to using multiple Docker containers running the Laravel stack. I've tried <code>php artisan cache:clear</code> and <code>php artisan config:cache</code>. I've deleted <code>bootstrap/cache/config.php</code> but the file just reappears with the old config like some undead creature haunting me.</p>
  
  <p>The only way I am able to get the cache to refresh is by completely removing containers with <code>docker-compose down</code> and then running the containers again.</p>
  
  <p>In my docker-compose below you can see that my app, queue and scheduler containers all run the Laravel stack with the codebase mounted from the host. Could this be contributing to the problem?</p>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: '3'
  services:
  
    #PHP Service
    app:
      build:
        context: .
        dockerfile: Dockerfile
      image: digitalocean.com/php
      container_name: app
      restart: unless-stopped
      tty: true
      env_file: '.env'
      environment:
        SERVICE_NAME: app
        SERVICE_TAGS: dev
        #APP_ENV: local
      working_dir: /var/www
      volumes:
        - ./:/var/www
        - ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
        - ./php/opcache.ini:/usr/local/etc/php/conf.d/opcache.ini
      networks:
        - app-network
  
    scheduler:
      image: digitalocean.com/php
      container_name: scheduler
      restart: unless-stopped
      depends_on:
        - app
      volumes:
        - .:/var/www
      env_file: '.env'
      environment:
        CONTAINER_ROLE: scheduler
      networks:
        - app-network
  
    queue:
      image: digitalocean.com/php
      container_name: queue
      restart: unless-stopped
      depends_on:
        - app
      volumes:
        - .:/var/www
        - ./supervisor/supervisord.conf:/etc/supervisor/supervisord.conf
        - ./supervisor/conf.d:/etc/supervisor/conf.d
      env_file: '.env'
      environment:
        CONTAINER_ROLE: queue
      networks:
        - app-network
  
    #Nginx Service
    webserver:
      image: nginx:alpine
      container_name: webserver
      restart: unless-stopped
      tty: true
      ports:
        - "${local_ip}:${host_web_port}:80"
        #- "${local_ip}:443:443"
      volumes:
        - ./:/var/www
        - ./nginx/conf.d/:/etc/nginx/conf.d/
      networks:
        - app-network
  
    #MySQL Service
    db:
      image: mysql:5.7.26
      container_name: db
      restart: unless-stopped
      tty: true
      ports:
        - "${local_ip}:${host_db_port}:3306"
      environment:
        MYSQL_DATABASE: dbname
        MYSQL_USER: laravel
        MYSQL_PASSWORD: password
        MYSQL_ROOT_PASSWORD: root_password
        SERVICE_TAGS: dev
        SERVICE_NAME: mysql
      volumes:
        - dbdata:/var/lib/mysql/
        - ./mysql/my.cnf:/etc/mysql/my.cnf
      networks:
        - app-network
  
  #Docker Networks
  networks:
    app-network:
      driver: bridge
  
  #Volumes
  volumes:
    dbdata:
      driver: local
  </code></pre>
  
  <p><strong>Can somebody tell me how I can reload the cache without the need to destroy the containers?</strong></p>
  
  <p>For the sake of completeness, I set up the Docker environment using this guide: <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose</a></p>
  
  <p>I am running the queue and scheduler containers using this guide: <a href="https://laravel-news.com/laravel-scheduler-queue-docker" rel="nofollow noreferrer">https://laravel-news.com/laravel-scheduler-queue-docker</a> . However I've modified the queue to run Supervisor. </p>
  
  <p>start.sh</p>
  
  <pre><code>#!/usr/bin/env bash
  
  set -e
  
  role=${CONTAINER_ROLE:-app}
  env=${APP_ENV:-production}
  
  if [ "$env" != "local" ]; then
      echo "Caching configuration..."
      (php artisan config:cache &amp;&amp; php artisan view:cache) # &amp;&amp; php artisan route:cache - can't cache route closures
  fi
  
  if [ "$role" = "app" ]; then
  
      exec php-fpm
  
  elif [ "$role" = "queue" ]; then
  
      echo "Running the queue..."
      /usr/bin/supervisord
  
  elif [ "$role" = "scheduler" ]; then
  
      while [ true ]
      do
        php artisan schedule:run --verbose --no-interaction &amp;
        sleep 60
      done
  
  else
      echo "Could not match the container role \"$role\""
      exit 1
  fi
  </code></pre>