Prune temporary data and cached SBOMs using docker scout cache prune --sboms
In this step, we will prune both temporary data and cached SBOMs using the docker scout cache prune --sboms
command.
In the previous step, we pruned only temporary data. Cached SBOMs are more persistent data generated when docker scout
analyzes an image to create a Software Bill of Materials. Keeping cached SBOMs can speed up future analyses of the same image, but they also consume disk space.
To demonstrate pruning SBOMs, let's first analyze an image to generate an SBOM. We'll use the ubuntu
image for this.
docker pull ubuntu
This command pulls the ubuntu
image.
Now, let's generate and cache the SBOM for the ubuntu
image.
docker scout sbom ubuntu
This command generates the SBOM for the ubuntu
image and caches it. You will see the SBOM output in your terminal.
Now, let's prune both temporary data and cached SBOMs. We will use the --sboms
flag with the docker scout cache prune
command.
docker scout cache prune --sboms
Again, you will be prompted to confirm the action. This time, the warning will indicate that both temporary data and cached SBOMs will be removed.
WARNING! This will remove all temporary cache data and cached SBOMs. Are you sure you want to continue? [y/N]
Type y
and press Enter to confirm.
y
You should see output indicating that temporary cache data and cached SBOMs have been pruned, along with the amount of space reclaimed. The space reclaimed should be larger than in the previous step because cached SBOMs were also removed.
Using the --sboms
flag gives you more aggressive cache cleaning, which is useful when you need to free up more disk space or if you suspect issues with cached SBOM data.