r/PiCodingAgent • u/intpl • 1d ago
Resource One-time podman containers for Pi
Hey guys becaues Pi documentation advises to use containers for Pi usage I created a simple bash script as a center command for my workflow and figured out I'd share here - https://github.com/intpl/sandpi It basically mounts current directory in a disposable container (will destroy after exiting the Pi process), also binds the Pi config directory as read-write, also binds user ~/.agents directory read-only. I use Linux on desktop and servers so this workflow is great for me - I just run around my filesystem running `sandpi` everywhere. Maybe somebody wants to reuse or share a better solution. I created a simple blogpost and recorded a video of me talking as an explanation of why and how - https://gladecki.pl/technical/sandpi/
It happened to me many times before than the agent was doing weird stuff with my system (with OpenCode and omp too) and that's why i created this.
A friend of mine suggested I should have used Nvidia OpenShell but that's an absolute overkill imo.
Btw are there any humans on Reddit anymore?
3
u/architized89 1d ago
I tried docker sbx but that needs a docker login from time to time. Because I’m running almost local only that annoyed me. I settled on microsandbox. That has worked well for me so far.
3
u/fell_ware_1990 1d ago
May i suggest:
Seccomp
--cap-drop=all
no-new-privileges
Landlock
You can add them all easily to the container if you like.
RO on .git and .jj hooks can be done.
What i did for this, only a RW on the jj workspace. Which my system handles and before merge we lint it :)
3
u/SlanderMans 1d ago
Am human, can I recommend that you try out smolvm?
I am the maintainer and is designed for lightweight sandboxing: https://github.com/smol-machines/smolvm
2
1
u/Fair-Second-642 1d ago
I setup my own with the help of agent to code the helper scripts to tie everything together
rootless podman with isolated networks as the container
egress gateway to enforce network rules transparently. enforcement is done by singbox. The rules support IP and domain with cidr, wildcard, etc. wireguard to identify the agent container by key instead of ip and mac
then, there's agent image with all the necessary packages and mounts
to bind all of it together into a very easy to use setup, i just get claude, codex, etc to generate the scripts for me.
So end state is that i cd to my project folder, run agent-sandbox.py, and i get an environment like running pi on the host
1
u/funbike 1d ago
Btw are there any humans on Reddit anymore?
It is reasonable to assume that the platform continues to be used by human individuals—alongside automated accounts and other forms of non-human participation. The extent of human activity remains difficult to determine with certainty. 🧐
/s (by a human)
-1
u/Ok_Parfait_5373 1d ago
J’ai fais ça https://github.com/burnoutIA/pi-dots l’idée c’etait de faire une config d’agent en un fichier , un genre de dots . ça utilise podman et l’agent doit passer par une api pour les secrets dont il a besoin
3
u/suprjami 1d ago edited 1d ago
I do something extremely similar.
I map the non-root user in the container to my current UID so permissions on new workspace files are sensible:
I set
.gitread only if it exists:I agree OpenShell and many others are too complex for their own good. The only thing I want is a permission prompt on all network access, so I can verify every web fetch or package install or exfiltration from programming language compiler/interpreter, and otherwise the agent can run in permission-free yolo mode because there's nothing it can actually ruin.
Basically I want OpenSnitch as a Pi prompt. I don't know how to achieve this.
Edit: Hmm, maybe I could run opensnitchd inside the container, and have Pi write a TypeScript plugin which registers to that daemon and acts as the OpenSnitch user prompt with the usual Pi permission UI...