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:
82
labs/lab-02-network/how-to-guides/create-custom-network.md
Normal file
82
labs/lab-02-network/how-to-guides/create-custom-network.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# How-To: Creare una Rete Docker Personalizzata
|
||||
|
||||
Guida rapida per creare reti Docker bridge con subnet personalizzate.
|
||||
|
||||
## Comando Rapido
|
||||
|
||||
```bash
|
||||
# Crea rete con subnet personalizzata
|
||||
docker network create --driver bridge --subnet 10.0.1.0/24 --gateway 10.0.1.1 my-custom-network
|
||||
```
|
||||
|
||||
## Sintassi Completa
|
||||
|
||||
```bash
|
||||
docker network create [OPTIONS] NETWORK
|
||||
|
||||
Options:
|
||||
--driver bridge # Driver di rete (default: bridge)
|
||||
--subnet SUBNET # CIDR block (es. 10.0.1.0/24)
|
||||
--gateway GATEWAY # Gateway IP (es. 10.0.1.1)
|
||||
--internal # Isola la rete (no accesso esterno)
|
||||
--attachable # Permette container stand-alone di collegarsi
|
||||
```
|
||||
|
||||
## Esempi
|
||||
|
||||
### Rete Pubblica Standard
|
||||
|
||||
```bash
|
||||
docker network create --driver bridge \
|
||||
--subnet 10.0.1.0/24 \
|
||||
--gateway 10.0.1.1 \
|
||||
my-public-network
|
||||
```
|
||||
|
||||
### Rete Privata Isolata
|
||||
|
||||
```bash
|
||||
docker network create --driver bridge \
|
||||
--subnet 10.0.2.0/24 \
|
||||
--gateway 10.0.2.1 \
|
||||
--internal \
|
||||
my-private-network
|
||||
```
|
||||
|
||||
### Rete Multi-Subnet
|
||||
|
||||
```bash
|
||||
docker network create --driver bridge \
|
||||
--subnet=10.0.10.0/24 \
|
||||
--gateway=10.0.10.1 \
|
||||
--subnet=10.0.20.0/24 \
|
||||
--gateway=10.0.20.1 \
|
||||
my-multi-network
|
||||
```
|
||||
|
||||
## Verifica
|
||||
|
||||
```bash
|
||||
# Lista reti
|
||||
docker network ls
|
||||
|
||||
# Ispeziona rete
|
||||
docker network inspect my-custom-network
|
||||
|
||||
# Rimuovi rete
|
||||
docker network rm my-custom-network
|
||||
```
|
||||
|
||||
## Nomenclatura Cloud (PARA-02)
|
||||
|
||||
| Locale | Cloud AWS | Raccomandazione |
|
||||
|--------|-----------|-----------------|
|
||||
| `vpc-main` | VPC | Nome principale VPC |
|
||||
| `public-subnet-1a` | Public Subnet | Subnet pubblica + AZ |
|
||||
| `private-subnet-1a` | Private Subnet | Subnet privata + AZ |
|
||||
| `10.0.1.0/24` | CIDR | /24 per subnet |
|
||||
|
||||
## Vedi Anche
|
||||
|
||||
- [Tutorial: Creare Reti VPC](../tutorial/01-create-vpc-networks.md)
|
||||
- [Reference: Docker Network Commands](../reference/docker-network-commands.md)
|
||||
Reference in New Issue
Block a user