Rebuild Your Docker Compose Stack

Published: Oct 6, 2020
Updated: Feb 16, 2024

When using volumes with Docker Compose, especially with Node.js projects, sometimes vague errors show up, like file permission errors for reading or writing a file. When this happens, it can be helpful to rebuild your Docker Compose stack from scratch to resolve these errors.

  1. Down everything, which stops and removes containers, and removes volumes

     docker-compose down -v
    
  2. List all volumes to confirm they’re removed

     docker volume ls
    
  3. If volumes still exist, remove them one-by-one

     docker volume rm <VOLUME_NAME>
    
  4. Build and up everything in detached mode

     docker-compose up -d --build