v2.30.0-pre5 7568a1c

network-isolation.md RawHistoryFolder

Network Isolation

Isolate applications in separate Docker networks for enhanced security.

Configuration

[network_isolation]
enabled = true
network_prefix = "gordon"

Options

Option Type Default Description
enabled bool false Enable per-app network isolation
network_prefix string "gordon" Prefix for created networks

How It Works

When network isolation is enabled, each application gets its own Docker network:

[network_isolation]
enabled = true
network_prefix = "gordon"

[routes]
"app.mydomain.com" = "myapp:latest"
"api.mydomain.com" = "myapi:latest"

Creates two isolated networks:

  • gordon-app-mydomain-com
  • gordon-api-mydomain-com

Network Naming

Networks are named: {prefix}-{domain-with-dashes}

Domain Network Name
app.mydomain.com gordon-app-mydomain-com
api.company.io gordon-api-company-io
staging.app.dev gordon-staging-app-dev

Security Benefits

Without Network Isolation

All containers can potentially communicate:

┌───────────────────────────────────────┐
│ Default Bridge Network                │
│                                       │
│  App A ←──────→ App B ←──────→ App C  │
│    ↕              ↕              ↕    │
│  DB A ←──────→ DB B  ←──────→  DB C   │
│                                       │
└───────────────────────────────────────┘

With Network Isolation

Each app is isolated with its dependencies:

┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐
│ gordon-app-a    │  │ gordon-app-b    │  │ gordon-app-c    │
│                 │  │                 │  │                 │
│  App A ←→ DB A  │  │  App B ←→ DB B  │  │  App C ←→ DB C  │
│                 │  │                 │  │                 │
└─────────────────┘  └─────────────────┘  └─────────────────┘
        ↑                   ↑                   ↑
        └───────── No direct communication ─────┘

Service Discovery

Within an isolated network, services are discoverable by name:

[network_isolation]
enabled = true

[attachments]
"app.mydomain.com" = ["postgres:latest", "redis:latest"]

Your application connects using simple hostnames:

# These work within the isolated network
db = connect("postgresql://postgres:5432/mydb")
cache = connect("redis://redis:6379")

Examples

Basic Isolation

[network_isolation]
enabled = true

[routes]
"app.mydomain.com" = "myapp:latest"
"api.mydomain.com" = "myapi:latest"

[attachments]
"app.mydomain.com" = ["app-postgres:latest"]
"api.mydomain.com" = ["api-postgres:latest"]

Each app gets its own network with its own database.

Production Configuration

[network_isolation]
enabled = true
network_prefix = "prod"

[routes]
"app.company.com" = "company-app:v2.1.0"
"api.company.com" = "company-api:v1.5.0"
"admin.company.com" = "admin-panel:v1.0.0"

Creates networks:

  • prod-app-company-com
  • prod-api-company-com
  • prod-admin-company-com

Shared Services with Network Groups

When apps need to communicate, use network groups:

[network_isolation]
enabled = true

[network_groups]
"backend" = ["app.mydomain.com", "api.mydomain.com"]

[attachments]
"backend" = ["shared-postgres:latest", "shared-redis:latest"]

Both apps share the gordon-backend network.

Inspecting Networks

View created networks:

docker network ls | grep gordon
# gordon-app-mydomain-com
# gordon-api-mydomain-com
# gordon-backend

Inspect a network:

docker network inspect gordon-app-mydomain-com
source
1# Network Isolation
2
3Isolate applications in separate Docker networks for enhanced security.
4
5## Configuration
6
7```toml
8[network_isolation]
9enabled = true
10network_prefix = "gordon"
11```
12
13## Options
14
15| Option | Type | Default | Description |
16|--------|------|---------|-------------|
17| `enabled` | bool | `false` | Enable per-app network isolation |
18| `network_prefix` | string | `"gordon"` | Prefix for created networks |
19
20## How It Works
21
22When network isolation is enabled, each application gets its own Docker network:
23
24```
25[network_isolation]
26enabled = true
27network_prefix = "gordon"
28
29[routes]
30"app.mydomain.com" = "myapp:latest"
31"api.mydomain.com" = "myapi:latest"
32```
33
34Creates two isolated networks:
35- `gordon-app-mydomain-com`
36- `gordon-api-mydomain-com`
37
38## Network Naming
39
40Networks are named: `{prefix}-{domain-with-dashes}`
41
42| Domain | Network Name |
43|--------|--------------|
44| `app.mydomain.com` | `gordon-app-mydomain-com` |
45| `api.company.io` | `gordon-api-company-io` |
46| `staging.app.dev` | `gordon-staging-app-dev` |
47
48## Security Benefits
49
50### Without Network Isolation
51
52All containers can potentially communicate:
53
54```
55┌───────────────────────────────────────┐
56│ Default Bridge Network                │
57│                                       │
58│  App A ←──────→ App B ←──────→ App C  │
59│    ↕              ↕              ↕    │
60│  DB A ←──────→ DB B  ←──────→  DB C   │
61│                                       │
62└───────────────────────────────────────┘
63```
64
65### With Network Isolation
66
67Each app is isolated with its dependencies:
68
69```
70┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐
71│ gordon-app-a    │  │ gordon-app-b    │  │ gordon-app-c    │
72│                 │  │                 │  │                 │
73│  App A ←→ DB A  │  │  App B ←→ DB B  │  │  App C ←→ DB C  │
74│                 │  │                 │  │                 │
75└─────────────────┘  └─────────────────┘  └─────────────────┘
76        ↑                   ↑                   ↑
77        └───────── No direct communication ─────┘
78```
79
80## Service Discovery
81
82Within an isolated network, services are discoverable by name:
83
84```toml
85[network_isolation]
86enabled = true
87
88[attachments]
89"app.mydomain.com" = ["postgres:latest", "redis:latest"]
90```
91
92Your application connects using simple hostnames:
93
94```python
95# These work within the isolated network
96db = connect("postgresql://postgres:5432/mydb")
97cache = connect("redis://redis:6379")
98```
99
100## Examples
101
102### Basic Isolation
103
104```toml
105[network_isolation]
106enabled = true
107
108[routes]
109"app.mydomain.com" = "myapp:latest"
110"api.mydomain.com" = "myapi:latest"
111
112[attachments]
113"app.mydomain.com" = ["app-postgres:latest"]
114"api.mydomain.com" = ["api-postgres:latest"]
115```
116
117Each app gets its own network with its own database.
118
119### Production Configuration
120
121```toml
122[network_isolation]
123enabled = true
124network_prefix = "prod"
125
126[routes]
127"app.company.com" = "company-app:v2.1.0"
128"api.company.com" = "company-api:v1.5.0"
129"admin.company.com" = "admin-panel:v1.0.0"
130```
131
132Creates networks:
133- `prod-app-company-com`
134- `prod-api-company-com`
135- `prod-admin-company-com`
136
137### Shared Services with Network Groups
138
139When apps need to communicate, use network groups:
140
141```toml
142[network_isolation]
143enabled = true
144
145[network_groups]
146"backend" = ["app.mydomain.com", "api.mydomain.com"]
147
148[attachments]
149"backend" = ["shared-postgres:latest", "shared-redis:latest"]
150```
151
152Both apps share the `gordon-backend` network.
153
154## Inspecting Networks
155
156View created networks:
157
158```bash
159docker network ls | grep gordon
160# gordon-app-mydomain-com
161# gordon-api-mydomain-com
162# gordon-backend
163```
164
165Inspect a network:
166
167```bash
168docker network inspect gordon-app-mydomain-com
169```
170
171## Related
172
173- [Network Groups](./network-groups.md)
174- [Attachments](./attachments.md)
175- [Configuration Overview](./index.md)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close