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
@@ -271,7 +271,7 @@ Key implementation points:
- Container name matches test expectations
- Healthcheck verifies non-root user
- Comments explain why no volumes/networks (future labs)
- Follows docker-compose V3.8 syntax
- Follows docker compose V3.8 syntax
- No ports exposed (security best practice)
TDD Context: Tests from Wave 0 check for user directive - this configuration should satisfy those tests.
@@ -282,7 +282,7 @@ INF-01 Compliance:
- No possibility of root execution
</action>
<verify>
<automated>cd labs/lab-01-iam && docker-compose config > /dev/null 2>&1 && echo "PASS: docker-compose.yml is valid" || echo "FAIL: docker-compose.yml has errors"</automated>
<automated>cd labs/lab-01-iam && docker compose config > /dev/null 2>&1 && echo "PASS: docker-compose.yml is valid" || echo "FAIL: docker-compose.yml has errors"</automated>
</verify>
<done>docker-compose.yml defines service with non-root user directive</done>
</task>
@@ -331,7 +331,7 @@ fail_count=0
# Test 1: docker-compose.yml is valid
echo -e "${BLUE}[1/6] Checking docker-compose.yml syntax...${NC}"
if docker-compose config >/dev/null 2>&1; then
if docker compose config >/dev/null 2>&1; then
echo -e " ${GREEN}${NC} docker-compose.yml is valid YAML"
((pass_count++))
else
@@ -402,11 +402,11 @@ else
fi
echo ""
# Test 6: Verify docker-compose service
echo -e "${BLUE}[6/6] Verifying docker-compose service...${NC}"
# Test 6: Verify docker compose service
echo -e "${BLUE}[6/6] Verifying docker compose service...${NC}"
# Start container in detached mode
if docker-compose up -d >/dev/null 2>&1; then
echo -e " ${GREEN}${NC} docker-compose service started"
if docker compose up -d >/dev/null 2>&1; then
echo -e " ${GREEN}${NC} docker compose service started"
# Wait for container to be ready
sleep 3
@@ -418,10 +418,10 @@ if docker-compose up -d >/dev/null 2>&1; then
# Verify user
actual_user=$(docker exec lab01-iam-test whoami 2>/dev/null || echo "unknown")
if [ "$actual_user" = "labuser" ]; then
echo -e " ${GREEN}${NC} docker-compose container runs as non-root"
echo -e " ${GREEN}${NC} docker compose container runs as non-root"
((pass_count++))
else
echo -e " ${RED}${NC} docker-compose container running as $actual_user (expected labuser)"
echo -e " ${RED}${NC} docker compose container running as $actual_user (expected labuser)"
((fail_count++))
fi
else
@@ -430,9 +430,9 @@ if docker-compose up -d >/dev/null 2>&1; then
fi
# Cleanup
docker-compose down --volumes >/dev/null 2>&1
docker compose down --volumes >/dev/null 2>&1
else
echo -e " ${RED}${NC} Failed to start docker-compose service"
echo -e " ${RED}${NC} Failed to start docker compose service"
((fail_count++))
fi
echo ""
@@ -466,7 +466,7 @@ Key implementation points:
- Verifies USER directive in Dockerfile
- Verifies user directive in docker-compose.yml
- Builds and tests Docker image
- Starts container with docker-compose and verifies execution
- Starts container with docker compose and verifies execution
- Proper cleanup after testing
- Clear pass/fail indicators
@@ -483,7 +483,7 @@ TDD Context: This script confirms the GREEN phase - infrastructure implementatio
<verification>
1. Dockerfile creates non-root user with USER directive
2. docker-compose.yml specifies user directive for service
3. docker-compose config validates without errors
3. docker compose config validates without errors
4. Docker build succeeds without warnings
5. Container execution verified as non-root (whoami, docker inspect, docker top)
6. All Wave 0 tests now pass (GREEN phase of TDD)