feat(lab-02): complete Phase 3 - Network & VPC lab
Implement Lab 02 with Docker bridge networks simulating VPC/Subnets. Test Infrastructure (RED phase): - 6 bash test scripts for network creation, isolation, INF-02 compliance - Fail-fast orchestration with run-all-tests.sh - Quick validation script for development Documentation (Diátaxis framework): - 3 tutorials: VPC creation, container deployment, isolation verification - 4 how-to guides: create network, inspect config, test isolation, cleanup - 3 reference docs: Docker network commands, Compose syntax, VPC mapping - 1 explanation: Docker ↔ VPC parallels (PARA-01/02/03/04) Infrastructure (GREEN phase): - docker-compose.yml with VPC networks (10.0.1.0/24, 10.0.2.0/24) - 5 services: web, app, db, test-public, test-private - INF-02 compliant: 127.0.0.1 bindings only, no 0.0.0.0 - Private network with --internal flag - Multi-homed app container (public + private networks) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
102
labs/lab-02-network/how-to-guides/cleanup-networks.md
Normal file
102
labs/lab-02-network/how-to-guides/cleanup-networks.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# How-To: Pulire le Reti Docker
|
||||
|
||||
Guida per rimuovere reti, container e volumi Docker.
|
||||
|
||||
## Pulire Container e Reti
|
||||
|
||||
### Singola Rete
|
||||
|
||||
```bash
|
||||
# Rimuovi rete specifica
|
||||
docker network rm my-network
|
||||
```
|
||||
|
||||
### Tutte le Reti Custom (preserva bridge, host, none)
|
||||
|
||||
```bash
|
||||
# Lista solo reti custom
|
||||
docker network ls --filter 'type=custom' -q | xargs docker network rm
|
||||
```
|
||||
|
||||
## Pulire Container e Reti Together
|
||||
|
||||
### Ferma e Rimuovi Tutti i Container
|
||||
|
||||
```bash
|
||||
docker stop $(docker ps -aq)
|
||||
docker rm $(docker ps -aq)
|
||||
```
|
||||
|
||||
### Rimuovi Tutte le Reti Non Usate
|
||||
|
||||
```bash
|
||||
docker network prune
|
||||
```
|
||||
|
||||
## Pulire per Lab Specifico
|
||||
|
||||
### Lab 02 Network Cleanup
|
||||
|
||||
```bash
|
||||
cd ~/laboratori-cloud/labs/lab-02-network
|
||||
|
||||
# Ferma e rimuovi container del compose
|
||||
docker compose down
|
||||
|
||||
# Rimuovi reti specifiche
|
||||
docker network rm lab02-vpc-public lab02-vpc-private 2>/dev/null || true
|
||||
|
||||
# Rimuovi volumi (opzionale)
|
||||
docker volume rm lab02-network_db-data 2>/dev/null || true
|
||||
```
|
||||
|
||||
### Reset Completo Lab 02
|
||||
|
||||
```bash
|
||||
cd ~/laboratori-cloud/labs/lab-02-network
|
||||
|
||||
# Tutto giu
|
||||
docker compose down -v --remove-orphans
|
||||
docker network prune -f
|
||||
docker volume prune -f
|
||||
```
|
||||
|
||||
## Verificare lo Stato di Pulizia
|
||||
|
||||
```bash
|
||||
# Container attivi
|
||||
docker ps
|
||||
|
||||
# Reti presenti
|
||||
docker network ls
|
||||
|
||||
# Volumi presenti
|
||||
docker volume ls
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Rete in Uso da Container
|
||||
|
||||
```bash
|
||||
# Trova container usando la rete
|
||||
docker network inspect my-network --format '{{json .Containers}}' | jq '.[] | .Name'
|
||||
|
||||
# Scollega tutti i container
|
||||
docker network disconnect -f my-network $(docker network inspect my-network --format '{{json .Containers}}' | jq -r '.[] | .Name')
|
||||
|
||||
# Rimuovi rete
|
||||
docker network rm my-network
|
||||
```
|
||||
|
||||
### Container con Rete "Ghost"
|
||||
|
||||
```bash
|
||||
# Pulizia completa Docker
|
||||
docker system prune -a --volumes
|
||||
```
|
||||
|
||||
## Vedi Anche
|
||||
|
||||
- [Reference: Docker Network Commands](../reference/docker-network-commands.md)
|
||||
- [How-To: Reset Ambiente Docker](../../how-to-guides/reset-docker-environment.md)
|
||||
Reference in New Issue
Block a user