mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-18 16:22:33 +01:00
Merge pull request #511 from konstruktoid/issue510
add support for .NanoCpus
This commit is contained in:
commit
f375045741
1 changed files with 6 additions and 3 deletions
|
@ -472,12 +472,15 @@ check_5_11() {
|
||||||
fail=0
|
fail=0
|
||||||
cpu_unlimited_containers=""
|
cpu_unlimited_containers=""
|
||||||
for c in $containers; do
|
for c in $containers; do
|
||||||
shares=$(docker inspect --format '{{ .HostConfig.CpuShares }}' "$c")
|
cpushares=$(docker inspect --format '{{ .HostConfig.CpuShares }}' "$c")
|
||||||
|
nanocpus=$(docker inspect --format '{{ .HostConfig.NanoCpus }}' "$c")
|
||||||
|
|
||||||
if docker inspect --format '{{ .Config.CpuShares }}' "$c" 2> /dev/null 1>&2; then
|
if docker inspect --format '{{ .Config.CpuShares }}' "$c" 2> /dev/null 1>&2; then
|
||||||
shares=$(docker inspect --format '{{ .Config.CpuShares }}' "$c")
|
cpushares=$(docker inspect --format '{{ .Config.CpuShares }}' "$c")
|
||||||
|
nanocpus=$(docker inspect --format '{{ .Config.NanoCpus }}' "$c")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$shares" = "0" ]; then
|
if [ "$cpushares" = "0" ] && [ "$nanocpus" = "0" ]; then
|
||||||
# If it's the first container, fail the test
|
# If it's the first container, fail the test
|
||||||
if [ $fail -eq 0 ]; then
|
if [ $fail -eq 0 ]; then
|
||||||
warn -s "$check"
|
warn -s "$check"
|
||||||
|
|
Loading…
Reference in a new issue