1

I'm using Docker to deploy a cookiecutter-django app to production. My question is when do I need to use --no-cache with docker-compose -f production.yml build?

In particular, if I make a change to one of the settings.py files, will that change get picked up without using --no-cache. And what about changes to requirments.txt files?

Brad Rhoads
  • 1,828
  • 3
  • 29
  • 52

1 Answers1

1

Docker will detect changes to files you copy into the image with COPY or ADD which will result in the cache being broken from that point forward. You can see this with the hash on the files being copied in the history. That hash includes the file contents along with meta-data on the files like permissions.

The times you need to use --no-cache involve external dependencies that docker cannot see, like packages being installed by a package manager (apt/yum) without specifying an explicit version, or downloading an artifact from a URL where the URL is the same but the content gets updated.

BMitch
  • 231,797
  • 42
  • 475
  • 450