Just for reference, here's my local "devcontainer" script:
exec podman container run --rm --read-only --network=llm \
--tmpfs=/tmp:size=128M \
--volume="$1":/workspace \
--entrypoint=/insert/agent/here \
container-image-here
This runs the specified agent in a read-only container with only /workspace and /tmp writable. Obviously, you need to prepare the image first from a Containerfile/Dockerfile, with the required toolchain and agent installed. I use agent-specific ssh keys that are baked into the image, but you could also bind-mount specific files from your own homedir if required.