diff --git a/docs/guide/references/troubleshooting.md b/docs/guide/references/troubleshooting.md index e696b61057..5fbf09a9d4 100644 --- a/docs/guide/references/troubleshooting.md +++ b/docs/guide/references/troubleshooting.md @@ -161,6 +161,22 @@ These errors occur when: - A previous Trivy process did not shut down cleanly - Trivy server is running with filesystem cache and holding a lock on the cache +#### Recommended for parallel runs / CI + +If you run multiple Trivy processes concurrently (for example, CI matrix jobs or background scans), ensure that each process uses a different filesystem cache directory to avoid sharing the same BoltDB lock. + +For example: + +```bash +$ trivy image --cache-dir /tmp/trivy-cache-1 debian:11 & +$ trivy image --cache-dir /tmp/trivy-cache-2 debian:12 & + +Note: +- No `$RANDOM` anymore +- Explicitly references what already exists conceptually +- Frames this as **recommended**, not “new” + + #### Solutions **Solution 1: Use memory cache or Redis cache** (Recommended) @@ -189,17 +205,6 @@ $ ps aux | grep trivy $ kill [process_id] ``` -**Solution 3: Use different cache directories** - -If you must run multiple Trivy processes with filesystem cache, specify different cache directories for each process: - -```bash -$ trivy image --cache-dir /tmp/trivy-cache-1 debian:11 & -$ trivy image --cache-dir /tmp/trivy-cache-2 debian:12 & -``` - -Note that each cache directory will download its own copy of the vulnerability database and other scan assets, which will increase network traffic and storage usage. - ### Multiple Trivy servers !!! error