title: how remove all docker containers and images associated with a particular Dockerfile + docker-compose.yml file?
body: <p>We frequently spin up some quick exploratory docker-based projects for a day or two that we'd like to quickly and easily discard when done, <em>without</em> disturbing our primary ongoing containers and images.</p>
  <p>At any point in time we have quite a few 'stable' docker images and containers that we do NOT want to rebuild all the time.</p>
  <p>How can one remove all the images and containers associated with the <em>current</em> directory's Dockerfile and docker-compose.yml file, without disturbing other projects' images and containers?</p>
  <p>(All the Docker documentation I see shows how to discard them ALL, or requires finding and listing a bunch of IDs manually and discarding them manually. This seems primitive and time-wasting... In a project folder, the Dockefile and docker-compose.yml file <em>have</em> all the info needed to identify &quot;all images and images that were created when building and running THIS project&quot; so it seems there would quick command to remove that project's docker dregs when done.)</p>
  <p>As an example, right now I have rarely revised Docker images and containers for several production Rails 5 apps I'd like to keep untouched, but a half-dozen folders with short-term Rails 6 experiments that represent dozens of images and containers I'd like to discard.</p>
  <p>Is there any way to tell Docker... &quot;here's a Dockerfile and a docker-compose,yml file, stop and remove any/all containers and images that were created by them?&quot;</p>