podman-rootless.md RawHistoryFolder

Podman Rootless Setup

Set up Gordon with Podman in rootless mode for enhanced security.

What You'll Learn

  • Installing Podman for rootless containers
  • Configuring firewall port forwarding
  • Running Gordon as a user service
  • Troubleshooting common issues

Prerequisites

  • Ubuntu 24.04 LTS or Debian 13
  • VPS with root access (for initial setup)
  • Domain pointing to your VPS

Why Rootless?

Rootless containers run without root privileges, providing:

  • Security: Container escapes don't grant root access
  • Isolation: Each user has separate container namespace
  • Simplicity: No Docker daemon required

Steps

1. System Preparation

# Update system
sudo apt update && sudo apt upgrade -y

# Install Podman and firewalld
sudo apt install -y podman firewalld

# Enable firewalld
sudo systemctl enable --now firewalld

2. Configure User Namespaces

# Enable user namespaces
echo 'user.max_user_namespaces=28633' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

# Setup subuid/subgid for your user
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER

3. Configure Firewall Port Forwarding

Rootless containers can't bind to ports below 1024. Forward 80/443 to high ports:

# Allow HTTP/HTTPS traffic
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https

# Forward privileged ports to unprivileged
sudo firewall-cmd --permanent --add-forward-port=port=80:proto=tcp:toport=8080
sudo firewall-cmd --permanent --add-forward-port=port=443:proto=tcp:toport=8443

# Apply changes
sudo firewall-cmd --reload

# Verify
sudo firewall-cmd --list-all

4. Enable Podman Socket

# Enable user Podman socket
systemctl --user enable --now podman.socket

# Verify
systemctl --user status podman.socket

5. Configure Registry Access

Allow pushing to localhost registry without TLS:

mkdir -p ~/.config/containers
cat > ~/.config/containers/registries.conf <<EOF
[registries.insecure]
registries = ['localhost:5000']
EOF

6. Install Gordon

# Download (choose your architecture)
wget https://github.com/bnema/gordon/releases/latest/download/gordon_linux_amd64.tar.gz
# or for ARM64:
# wget https://github.com/bnema/gordon/releases/latest/download/gordon_linux_arm64.tar.gz

tar -xzf gordon_linux_*.tar.gz
chmod +x gordon
sudo mv gordon /usr/local/bin/

7. Configure Gordon

Generate initial config:

gordon serve
# Press Ctrl+C after config is created

Edit ~/.config/gordon/gordon.toml:

[server]
port = 8080                              # Must match firewall forward (80 → 8080)
registry_port = 5000
gordon_domain = "gordon.mydomain.com"

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

8. Create Systemd User Service

mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/gordon.service <<EOF
[Unit]
Description=Gordon Container Platform
After=podman.socket

[Service]
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/gordon serve

[Install]
WantedBy=default.target
EOF

# Enable and start
systemctl --user daemon-reload
systemctl --user enable --now gordon

9. Enable Linger

Keep services running after logout:

sudo loginctl enable-linger $USER

10. Verify Setup

# Check Gordon status
systemctl --user status gordon

# Check logs
journalctl --user -u gordon -f

# Test registry
curl -v http://localhost:5000/v2/

Tailscale Integration

If using Tailscale for management:

# Add Tailscale interface to trusted zone
sudo firewall-cmd --permanent --zone=trusted --add-interface=tailscale0

# Allow Tailscale WireGuard port
sudo firewall-cmd --permanent --add-port=41641/udp

# Apply
sudo firewall-cmd --reload

Common Issues

"permission denied" on podman

# Ensure podman socket is running
systemctl --user status podman.socket

# Restart if needed
systemctl --user restart podman.socket

Containers can't access network

# Check slirp4netns is installed
which slirp4netns

# Install if missing
sudo apt install slirp4netns

Port forwarding not working

# Verify rules
sudo firewall-cmd --list-all

# Check Gordon is using correct port
grep "port =" ~/.config/gordon/gordon.toml

Service stops after logout

# Enable linger
sudo loginctl enable-linger $USER

# Verify
loginctl show-user $USER | grep Linger

Next Steps

source
1# Podman Rootless Setup
2
3Set up Gordon with Podman in rootless mode for enhanced security.
4
5## What You'll Learn
6
7- Installing Podman for rootless containers
8- Configuring firewall port forwarding
9- Running Gordon as a user service
10- Troubleshooting common issues
11
12## Prerequisites
13
14- Ubuntu 24.04 LTS or Debian 13
15- VPS with root access (for initial setup)
16- Domain pointing to your VPS
17
18## Why Rootless?
19
20Rootless containers run without root privileges, providing:
21
22- **Security**: Container escapes don't grant root access
23- **Isolation**: Each user has separate container namespace
24- **Simplicity**: No Docker daemon required
25
26## Steps
27
28### 1. System Preparation
29
30```bash
31# Update system
32sudo apt update && sudo apt upgrade -y
33
34# Install Podman and firewalld
35sudo apt install -y podman firewalld
36
37# Enable firewalld
38sudo systemctl enable --now firewalld
39```
40
41### 2. Configure User Namespaces
42
43```bash
44# Enable user namespaces
45echo 'user.max_user_namespaces=28633' | sudo tee -a /etc/sysctl.conf
46sudo sysctl -p
47
48# Setup subuid/subgid for your user
49sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER
50```
51
52### 3. Configure Firewall Port Forwarding
53
54Rootless containers can't bind to ports below 1024. Forward 80/443 to high ports:
55
56```bash
57# Allow HTTP/HTTPS traffic
58sudo firewall-cmd --permanent --add-service=http
59sudo firewall-cmd --permanent --add-service=https
60
61# Forward privileged ports to unprivileged
62sudo firewall-cmd --permanent --add-forward-port=port=80:proto=tcp:toport=8080
63sudo firewall-cmd --permanent --add-forward-port=port=443:proto=tcp:toport=8443
64
65# Apply changes
66sudo firewall-cmd --reload
67
68# Verify
69sudo firewall-cmd --list-all
70```
71
72### 4. Enable Podman Socket
73
74```bash
75# Enable user Podman socket
76systemctl --user enable --now podman.socket
77
78# Verify
79systemctl --user status podman.socket
80```
81
82### 5. Configure Registry Access
83
84Allow pushing to localhost registry without TLS:
85
86```bash
87mkdir -p ~/.config/containers
88cat > ~/.config/containers/registries.conf <<EOF
89[registries.insecure]
90registries = ['localhost:5000']
91EOF
92```
93
94### 6. Install Gordon
95
96```bash
97# Download (choose your architecture)
98wget https://github.com/bnema/gordon/releases/latest/download/gordon_linux_amd64.tar.gz
99# or for ARM64:
100# wget https://github.com/bnema/gordon/releases/latest/download/gordon_linux_arm64.tar.gz
101
102tar -xzf gordon_linux_*.tar.gz
103chmod +x gordon
104sudo mv gordon /usr/local/bin/
105```
106
107### 7. Configure Gordon
108
109Generate initial config:
110
111```bash
112gordon serve
113# Press Ctrl+C after config is created
114```
115
116Edit `~/.config/gordon/gordon.toml`:
117
118```toml
119[server]
120port = 8080                              # Must match firewall forward (80 → 8080)
121registry_port = 5000
122gordon_domain = "gordon.mydomain.com"
123
124[routes]
125"app.mydomain.com" = "myapp:latest"
126```
127
128### 8. Create Systemd User Service
129
130```bash
131mkdir -p ~/.config/systemd/user
132cat > ~/.config/systemd/user/gordon.service <<EOF
133[Unit]
134Description=Gordon Container Platform
135After=podman.socket
136
137[Service]
138Type=simple
139Restart=always
140RestartSec=5
141ExecStart=/usr/local/bin/gordon serve
142
143[Install]
144WantedBy=default.target
145EOF
146
147# Enable and start
148systemctl --user daemon-reload
149systemctl --user enable --now gordon
150```
151
152### 9. Enable Linger
153
154Keep services running after logout:
155
156```bash
157sudo loginctl enable-linger $USER
158```
159
160### 10. Verify Setup
161
162```bash
163# Check Gordon status
164systemctl --user status gordon
165
166# Check logs
167journalctl --user -u gordon -f
168
169# Test registry
170curl -v http://localhost:5000/v2/
171```
172
173## Tailscale Integration
174
175If using Tailscale for management:
176
177```bash
178# Add Tailscale interface to trusted zone
179sudo firewall-cmd --permanent --zone=trusted --add-interface=tailscale0
180
181# Allow Tailscale WireGuard port
182sudo firewall-cmd --permanent --add-port=41641/udp
183
184# Apply
185sudo firewall-cmd --reload
186```
187
188## Common Issues
189
190### "permission denied" on podman
191
192```bash
193# Ensure podman socket is running
194systemctl --user status podman.socket
195
196# Restart if needed
197systemctl --user restart podman.socket
198```
199
200### Containers can't access network
201
202```bash
203# Check slirp4netns is installed
204which slirp4netns
205
206# Install if missing
207sudo apt install slirp4netns
208```
209
210### Port forwarding not working
211
212```bash
213# Verify rules
214sudo firewall-cmd --list-all
215
216# Check Gordon is using correct port
217grep "port =" ~/.config/gordon/gordon.toml
218```
219
220### Service stops after logout
221
222```bash
223# Enable linger
224sudo loginctl enable-linger $USER
225
226# Verify
227loginctl show-user $USER | grep Linger
228```
229
230## Next Steps
231
232- [Set up secrets](./secrets-pass.md)
233- [Deploy your first app](/wiki/tutorials/first-deploy.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