docker / scout-cli

Docker Scout CLI
https://docker.com/products/docker-scout
Other
252 stars 60 forks source link

Add command prune for purge the images in the cache #35

Closed oleksis closed 10 months ago

oleksis commented 10 months ago

docker scout prune

Frees up disk space of images that docker scout saves in the cache for vulnerability analysis

➜ Remove-Item -Force -Recurse "~\AppData\Local\Temp\docker-scout\sha256" 
cdupuis commented 10 months ago

Thanks for raising this.

We’ve added a docker scout cache command with several sub commands to manage the file system cache. Including support for pruning. This will get released in the next version. I’ll leave this open until the version is available.

oleksis commented 10 months ago

Thank you for adding the desired functionality. I will keep an eye on the next version released and the issue can be closed

eunomie commented 10 months ago

The new release v0.23.0 now contains these two commands:

oleksis commented 10 months ago

Good work for docker-scout v0.23.0 .

PD: could transcribe 'install.sh' for use Powershell on Windows ?

➜ docker scout version
version: 0.20.0 (go1.20.6 - windows/amd64)
git commit: c27fb3e34367f77a565de72ed23ed4c0f10c3642

➜ Invoke-WebRequest `
 -Uri https://github.com/docker/scout-cli/releases/download/v0.23.0/docker-scout_0.23.0_windows_amd64.zip `
 -OutFile docker-scout.zip
➜ Expand-Archive -Path .\docker-scout.zip -DestinationPath .\
➜ mkdir -p $env:USERPROFILE\.docker\cli-plugins
➜ Copy-Item -Force -Path .\docker-scout.exe -Destination $env:USERPROFILE\.docker\cli-plugins\

➜ docker scout version

      ⢀⢀⢀             ⣀⣀⡤⣔⢖⣖⢽⢝
   ⡠⡢⡣⡣⡣⡣⡣⡣⡢⡀    ⢀⣠⢴⡲⣫⡺⣜⢞⢮⡳⡵⡹⡅
  ⡜⡜⡜⡜⡜⡜⠜⠈⠈        ⠁⠙⠮⣺⡪⡯⣺⡪⡯⣺
 ⢘⢜⢜⢜⢜⠜               ⠈⠪⡳⡵⣹⡪⠇
 ⠨⡪⡪⡪⠂    ⢀⡤⣖⢽⡹⣝⡝⣖⢤⡀    ⠘⢝⢮⡚       _____                 _
  ⠱⡱⠁    ⡴⡫⣞⢮⡳⣝⢮⡺⣪⡳⣝⢦    ⠘⡵⠁      / ____| Docker        | |
   ⠁    ⣸⢝⣕⢗⡵⣝⢮⡳⣝⢮⡺⣪⡳⣣    ⠁      | (___   ___ ___  _   _| |_
        ⣗⣝⢮⡳⣝⢮⡳⣝⢮⡳⣝⢮⢮⡳            \___ \ / __/ _ \| | | | __|
   ⢀    ⢱⡳⡵⣹⡪⡳⣝⢮⡳⣝⢮⡳⡣⡏    ⡀       ____) | (_| (_) | |_| | |_
  ⢀⢾⠄    ⠫⣞⢮⡺⣝⢮⡳⣝⢮⡳⣝⠝    ⢠⢣⢂     |_____/ \___\___/ \__,_|\__|
  ⡼⣕⢗⡄    ⠈⠓⠝⢮⡳⣝⠮⠳⠙     ⢠⢢⢣⢣
 ⢰⡫⡮⡳⣝⢦⡀              ⢀⢔⢕⢕⢕⢕⠅
 ⡯⣎⢯⡺⣪⡳⣝⢖⣄⣀        ⡀⡠⡢⡣⡣⡣⡣⡣⡃
⢸⢝⢮⡳⣝⢮⡺⣪⡳⠕⠗⠉⠁    ⠘⠜⡜⡜⡜⡜⡜⡜⠜⠈
⡯⡳⠳⠝⠊⠓⠉             ⠈⠈⠈⠈

version: 0.23.0 (go1.21.0 - windows/amd64)
git commit: 1f34fe6fde9caa2ecd25761e53a0d633bac328f5

➜ docker scout cache df
Docker Scout temporary directory to generate SBOMs is located at:
   C:\Users\oleksis\AppData\Local\Temp\docker-scout
  this path can be configured using the  DOCKER_SCOUT_CACHE_DIR  environment variable

                               Image Digest                               │  Size
──────────────────────────────────────────────────────────────────────────┼─────────
  sha256:357784bd89513804ce98a4e3879810260ad5f2ed07764d69c75a2f95e6e763b4 │ 3.1 GB

Total: 3.1 GB

Docker Scout cached SBOMs are located at:
   C:\Users\oleksis\.docker\scout\sbom

                               Image Digest                               │ Size of SBOM
──────────────────────────────────────────────────────────────────────────┼───────────────
  sha256:357784bd89513804ce98a4e3879810260ad5f2ed07764d69c75a2f95e6e763b4 │ 35 kB
  sha256:9e4d3ca6b1dae0474a7c243572a5754906a132d04585047eeae2125e5c52161e │ 35 kB
  sha256:a620dd235ca1f50c2991ce3aea13f23ccc565525ed82a7719935ce436810cb74 │ 35 kB

Total: 105 kB

What's Next?
  Delete all cached SBOMs → docker scout cache prune