docker / docker-bench-security

The Docker Bench for Security is a script that checks for dozens of common best-practices around deploying Docker containers in production.
Apache License 2.0
9.17k stars 1.02k forks source link

Ensure image sprawl is avoided miscalculation #532

Closed halfluke closed 1 year ago

halfluke commented 1 year ago

[INFO] 6 - Docker Security Operations [INFO] 6.1 - Ensure that image sprawl is avoided (Manual) [INFO] There are currently: 14 images [INFO] Only 0 out of 14 are in use

fix: change for c in $(docker inspect --format "{{.Image}}" "$(docker ps -qa)" 2>/dev/null); do to for c in $(docker inspect --format "{{.Image}}" $(docker ps -qa) 2>/dev/null); do

The first command returns an error for the first image and the whole count fails

konstruktoid commented 1 year ago

Hi @halfluke and thanks for find this issue.

Could you submit a PR?