Skip to main content

Run the Vibgrate CLI with Docker

Run a Vibgrate drift scan inside Docker by mounting your project into a Node container. The scan stays isolated from your host and reproducible in CI.

Difficulty
Intermediate
Duration
15 minutes
Steps
5

Running the Vibgrate CLI in Docker keeps your scan isolated from the host toolchain and makes it easy to reproduce the same environment locally and in CI. You mount your project into a Node container and run the no-install npx form of the CLI.

Prerequisites

  • Docker installed and running
  • A project directory to scan

Steps

1. Confirm Docker is running

docker --version

2. Choose a Node image

The CLI runs on Node, so any maintained Node image works as the base. You will run the no-install npx @vibgrate/cli scan form inside it.

3. Mount the project and scan

Mount your current directory into the container and run the scan against it. The -w flag sets the working directory so the scan targets your mounted code.

docker run --rm -v "$PWD":/work -w /work node:20 npx @vibgrate/cli scan

Docker pulls the image if needed, then npx fetches and runs the CLI against your mounted project.

4. Read the DriftScore

The scan prints a results table and a DriftScore from 0 to 100 summarizing dependency drift, exactly as it would on the host. Nothing is left behind because --rm removes the container when it exits.

5. Add a failure gate

To make the container fail when issues are present, add a failure gate.

docker run --rm -v "$PWD":/work -w /work node:20 npx @vibgrate/cli scan --fail-on error

The container exit code reflects the gate, which is ideal for pipelines.

Verification

The container prints a results table and DriftScore. With --fail-on error, the container exits non-zero when qualifying findings exist, so echo $? after the run reflects the gate result.

Next Steps

  • Want the CLI permanently on the host? Install globally with npm.
  • Putting this in a pipeline? See the GitHub Actions and exit codes tutorials.
  • Need reproducible config? Commit a config file with vg init.

Prerequisites

  • Docker installed and running
  • A project directory to scan

Steps

  • 1
    Confirm Docker is running
  • 2
    Choose a Node image
  • 3
    Mount the project and scan
  • 4
    Read the DriftScore
  • 5
    Add a failure gate

Category

Vibgrate