mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-18 16:22:33 +01:00
Merge pull request #41 from konstruktoid/exclude_container
consistent labeling
This commit is contained in:
commit
2a0241d839
2 changed files with 3 additions and 3 deletions
|
@ -38,7 +38,7 @@ docker run -it --net host --pid host --cap-add audit_control \
|
|||
-v /var/lib:/var/lib \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /usr/lib/systemd:/usr/lib/systemd \
|
||||
-v /etc:/etc --label security-benchmark \
|
||||
-v /etc:/etc --label docker-bench-security \
|
||||
docker-bench-security
|
||||
```
|
||||
|
||||
|
|
|
@ -73,11 +73,11 @@ done
|
|||
main () {
|
||||
# List all running containers
|
||||
containers=$(docker ps -q)
|
||||
# If there is a container with label docker-bench, memorize it:
|
||||
# If there is a container with label docker-bench-security, memorize it:
|
||||
benchcont="nil"
|
||||
for c in $containers; do
|
||||
labels=$(docker inspect --format '{{ .Config.Labels }}' "$c")
|
||||
contains "$labels" "docker-bench" && benchcont="$c"
|
||||
contains "$labels" "docker-bench-security" && benchcont="$c"
|
||||
done
|
||||
# List all running containers except docker-bench
|
||||
containers=$(docker ps -q | grep -v "$benchcont")
|
||||
|
|
Loading…
Reference in a new issue