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
@@ -165,7 +165,7 @@ services:
### Pitfall 3: Insufficient Verification of Non-Root Execution
**What goes wrong:** Container configured with `USER` directive but still running as root
**Why it happens:** Dockerfile USER directive not applied, or docker-compose `user` override missing, or container switches back to root
**Why it happens:** Dockerfile USER directive not applied, or docker compose `user` override missing, or container switches back to root
**How to avoid:** Always verify with `docker exec <container> whoami` AND `docker inspect <container> | grep User`
**Warning signs:** Container process shows as root in `docker top` or `docker inspect`
@@ -204,7 +204,7 @@ docker exec <container_name> whoami
# Method 2: Inspect container configuration
docker inspect <container_name> --format='{{.State.User}}'
# Note: May show empty if using docker-compose user directive
# Note: May show empty if using docker compose user directive
# Method 3: Check process on host
docker top <container_name>
@@ -389,8 +389,8 @@ echo "All tests passed!" || echo "Some tests failed"
**Automated Verification:**
```bash
# Test runs for every container defined in docker-compose.yml
for service in $(docker-compose ps --services); do
container_name=$(docker-compose ps -q $service)
for service in $(docker compose ps --services); do
container_name=$(docker compose ps -q $service)
actual_user=$(docker exec $container_name whoami 2>/dev/null)
if [ "$actual_user" = "root" ]; then
echo "FAIL: $service running as root"
@@ -402,7 +402,7 @@ echo "PASS: All containers running as non-root"
**Manual Verification:**
1. Check docker-compose.yml for `user:` directive on all services
2. Run `docker-compose ps` to get container names
2. Run `docker compose ps` to get container names
3. Run `docker top <container>` and verify USER column != root
4. Run `docker inspect <container>` and verify Config.User is set