|
| 1 | +# Podman Setup for GoClaw |
| 2 | + |
| 3 | +Podman rootless server configuration and networking fixes. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +```bash |
| 8 | +./setup.sh |
| 9 | +``` |
| 10 | + |
| 11 | +## What We Learned |
| 12 | + |
| 13 | +### DNS Resolution Issue |
| 14 | + |
| 15 | +**Problem**: Docker's `127.0.0.11` DNS resolver doesn't work in Podman. |
| 16 | + |
| 17 | +When GoClaw's nginx tries to resolve `goclaw` hostname, it fails because: |
| 18 | +- Docker: Containers use Docker's embedded DNS at `127.0.0.11` |
| 19 | +- Podman: Uses `aardvark-dns` listening on the network gateway IP |
| 20 | + |
| 21 | +**Symptom**: `nginx: [emerg] host not found` in container logs. |
| 22 | + |
| 23 | +**Solution**: Set `NGINX_DNS_RESOLVER` env var to podman's gateway IP (e.g., `10.89.1.1`). |
| 24 | + |
| 25 | +The nginx image's entrypoint processes `*.template` files with envsubst, so the resolver is set at runtime. |
| 26 | + |
| 27 | +### Podman Network Gateway IP |
| 28 | + |
| 29 | +Podman's aardvark-dns listens on the bridge network gateway. To find it: |
| 30 | + |
| 31 | +```bash |
| 32 | +podman network inspect auto_default | grep gateway |
| 33 | +# or |
| 34 | +podman exec goclaw-ui cat /etc/resolv.conf |
| 35 | +``` |
| 36 | + |
| 37 | +Common pattern: `10.89.0.1` or `10.89.1.1` (third octet may vary) |
| 38 | + |
| 39 | +## Files |
| 40 | + |
| 41 | +| File | Purpose | |
| 42 | +|------|---------| |
| 43 | +| `setup.sh` | Copies configs to `~/.config/containers/` | |
| 44 | +| `config/containers.conf` | Rootless podman config (userns, group_add, umask) | |
| 45 | +| `config/storage.conf` | Overlay storage driver at `/opt/storage` | |
| 46 | +| `config/registries.conf` | Add docker.io as default search | |
| 47 | +| `config/mise.podman.toml` | Mise podman environment settings | |
| 48 | +| `config/miserc.toml` | Mise config activation | |
| 49 | +| `podman-network-fix.yml` | Compose overlay for network settings | |
| 50 | +| `podman-user-fix.yml` | User namespace fixes | |
| 51 | + |
| 52 | +## Usage |
| 53 | + |
| 54 | +### With Docker Compose |
| 55 | +```bash |
| 56 | +# Include the network fix overlay |
| 57 | +docker compose -f docker-compose.yml \ |
| 58 | + -f docker-compose.postgres.yml \ |
| 59 | + -f options/podman/podman-network-fix.yml \ |
| 60 | + up -d |
| 61 | +``` |
| 62 | + |
| 63 | +### With setup.sh |
| 64 | +```bash |
| 65 | +cd options/podman |
| 66 | +./setup.sh |
| 67 | +# Then use compose normally - setup.sh copies overlays to compose.d/ |
| 68 | +# ./prepare-compose.sh - Compiles COMPOSE_FILE from compose.d/*.yml |
| 69 | +``` |
| 70 | + |
| 71 | +## Troubleshooting |
| 72 | + |
| 73 | +### nginx fails to resolve goclaw |
| 74 | +Check logs: `podman logs goclaw-ui` |
| 75 | +Verify resolver: `podman exec goclaw-ui nginx -T | grep resolver` |
| 76 | + |
| 77 | +### Can't access volume data |
| 78 | +Podman rootless uses overlayfs. Files may be owned by root inside container but appear as numeric UID outside. |
| 79 | +Use `podman unshare` to access or check with `podman exec stat /path` |
| 80 | + |
| 81 | +### Database permissions |
| 82 | +Postgres runs as UID 70 inside container. With `keep-id` in containers.conf, using `0:0` inside the container maps to the external owner: |
| 83 | +```bash |
| 84 | +# Fix ownership (0:0 maps to external UID via keep-id) |
| 85 | +podman unshare chown -R 0:0 /srv/your-volume |
| 86 | +``` |
| 87 | + |
| 88 | +## See Also |
| 89 | + |
| 90 | +- [Podman Networking](https://docs.podman.io/en/latest/markdown/podman.1.html#network) |
| 91 | +- [aardvark-dns](https://github.com/containers/aardvark-dns) |
| 92 | +- [Nginx Resolver](https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver) |
0 commit comments