Fix: Add -it flags to docker run commands for interactive PostgreSQL client access in lab-05-database

This commit is contained in:
Luca Sacchi Ricciardi
2026-04-16 16:41:03 +02:00
parent ef42f891d9
commit b011892e97
4 changed files with 4 additions and 4 deletions
@@ -5,7 +5,7 @@
### Da container nella stessa rete ### Da container nella stessa rete
```bash ```bash
docker run --rm --network lab05-vpc-private \ docker run --rm -it --network lab05-vpc-private \
-e PGPASSWORD=lab05_password \ -e PGPASSWORD=lab05_password \
postgres:16-alpine \ postgres:16-alpine \
psql -h db -U lab05_user -d lab05_db psql -h db -U lab05_user -d lab05_db
@@ -9,7 +9,7 @@
docker exec lab05-db psql -U lab05_user -d lab05_db docker exec lab05-db psql -U lab05_user -d lab05_db
# Connessione da client nella rete privata # Connessione da client nella rete privata
docker run --rm --network lab05-vpc-private \ docker run --rm -it --network lab05-vpc-private \
-e PGPASSWORD=lab05_password \ -e PGPASSWORD=lab05_password \
postgres:16-alpine \ postgres:16-alpine \
psql -h db -U lab05_user -d lab05_db psql -h db -U lab05_user -d lab05_db
@@ -112,7 +112,7 @@ Puoi connetterti SOLO da container nella stessa rete privata.
Esegui da un client PostgreSQL temporaneo collegato alla rete privata: Esegui da un client PostgreSQL temporaneo collegato alla rete privata:
```bash ```bash
# Connettiti da un client nella stessa rete privata # Connettiti da un client nella stessa rete privata
docker run --rm --network lab05-vpc-private \ docker run --rm -it --network lab05-vpc-private \
-e PGPASSWORD=lab05_password \ -e PGPASSWORD=lab05_password \
postgres:16-alpine \ postgres:16-alpine \
psql -h db -U lab05_user -d lab05_db psql -h db -U lab05_user -d lab05_db
@@ -66,7 +66,7 @@ psql -h localhost -U lab05_user -d lab05_db 2>&1 || echo "Corretto: non accessib
docker exec lab05-app ping -c 2 db docker exec lab05-app ping -c 2 db
# Prova query SQL da un client nella rete privata (DEVE riuscire) # Prova query SQL da un client nella rete privata (DEVE riuscire)
docker run --rm --network lab05-vpc-private \ docker run --rm -it --network lab05-vpc-private \
-e PGPASSWORD=lab05_password \ -e PGPASSWORD=lab05_password \
postgres:16-alpine \ postgres:16-alpine \
psql -h db -U lab05_user -d lab05_db -c "SELECT 1;" psql -h db -U lab05_user -d lab05_db -c "SELECT 1;"