-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcap_doc.sh
More file actions
22 lines (18 loc) · 755 Bytes
/
cap_doc.sh
File metadata and controls
22 lines (18 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# Loop through all running containers
for container in $(docker ps -q); do
# Get the container name
container_name=$(docker inspect --format '{{.Name}}' "$container" | sed 's/^\///')
echo "Checking capabilities for container: $container_name (ID: $container)"
# Use docker exec to check capabilities inside the container
docker exec "$container" bash -c "
echo 'Capabilities for container $container_name (ID: $container):'
if command -v capsh &> /dev/null; then
capsh --print
else
echo 'capsh not found, using /proc/self/status'
grep CapBnd /proc/self/status
fi
"
echo "----------------------------------------------------"
done