Skip to content

Docker

cache-detective is published on Docker Hub and GHCR. The entrypoint is the cache-detective binary itself, so any CLI command works after the image name.

Terminal window
docker run --rm ghcr.io/cerberauth/cache-detective scan --url https://example.com/
Terminal window
docker run --rm cerberauth/cache-detective scan --url https://example.com/

Mounting a list file, sitemap output, or a .har import

Section titled “Mounting a list file, sitemap output, or a .har import”

Commands that read a local file (--list, --har) need that file inside the container. Mount the containing directory as a volume and reference the in-container path:

Terminal window
docker run --rm -v "$(pwd)":/data ghcr.io/cerberauth/cache-detective \
scan --list /data/urls.txt
Terminal window
docker run --rm -v "$(pwd)":/data ghcr.io/cerberauth/cache-detective \
scan --har /data/session.har
Terminal window
docker run --rm ghcr.io/cerberauth/cache-detective \
scan --url https://staging.example.com/ --aggressive

When probing a server running in another container, join its network:

Terminal window
docker run --rm --network container:api ghcr.io/cerberauth/cache-detective \
scan --url http://localhost:8080/

Run cache-detective as a one-off step alongside a service under test:

services:
api:
build: .
ports:
- '8080:8080'
cache-detective:
image: ghcr.io/cerberauth/cache-detective
depends_on:
- api
command: ['scan', '--url', 'http://api:8080/']
Terminal window
docker compose run --rm cache-detective
  1. Clone the repository:

    Terminal window
    git clone https://github.com/cerberauth/cache-detective.git
    cd cache-detective
  2. Build the image using the dev Dockerfile:

    Terminal window
    docker build -f .docker/Dockerfile-build -t cache-detective .
  3. Run it:

    Terminal window
    docker run --rm cache-detective scan --url https://example.com/

To run cache-detective in CI, see the GitHub Actions guide. To use the container image directly in a workflow step:

- name: Scan for cache misconfigurations
run: docker run --rm ghcr.io/cerberauth/cache-detective scan --url https://staging.example.com/ --output-format json --output report.json