refactor: replace deprecated docker-compose with docker compose across repository

This commit is contained in:
Luca Sacchi Ricciardi
2026-04-09 12:15:00 +02:00
parent 64b7d49056
commit dceefe0573
33 changed files with 115 additions and 114 deletions
@@ -49,7 +49,8 @@ echo ""
# Test 3: Non-root container execution (INF-01)
echo -e "${BLUE}[3/3] Checking non-root container execution (INF-01)...${NC}"
compose_file="labs/lab-01-iam/docker-compose.yml"
cd labs/lab-01-iam
compose_file="docker-compose.yml"
if [ ! -f "$compose_file" ]; then
echo -e " ${YELLOW}${NC} docker-compose.yml not found"
all_passed=false
@@ -65,11 +66,11 @@ else
fi
# If containers are running, verify they're not root
if docker-compose -f "$compose_file" ps --services 2>/dev/null | grep -q .; then
if docker compose -f "$compose_file" ps --services 2>/dev/null | grep -q .; then
local root_count=0
while IFS= read -r service; do
[ -z "$service" ] && continue
local container=$(docker-compose -f "$compose_file" ps -q "$service" 2>/dev/null || echo "")
local container=$(docker compose -f "$compose_file" ps -q "$service" 2>/dev/null || echo "")
if [ -n "$container" ]; then
local user=$(docker exec "$container" whoami 2>/dev/null || echo "unknown")
if [ "$user" = "root" ]; then
@@ -77,7 +78,7 @@ else
((root_count++)) || true
fi
fi
done <<< "$(docker-compose -f "$compose_file" ps --services 2>/dev/null)"
done <<< "$(docker compose -f "$compose_file" ps --services 2>/dev/null)"
if [ $root_count -eq 0 ]; then
echo -e " ${GREEN}${NC} All running containers are non-root"
@@ -85,7 +86,7 @@ else
all_passed=false
fi
else
echo -e " ${YELLOW}${NC} No containers running (start with docker-compose up)"
echo -e " ${YELLOW}${NC} No containers running (start with docker compose up)"
fi
fi
echo ""