Anthropic's reference devcontainer pairs a container with an init script that allows only required domains and drops everything else. It is a template for running agents in permissive modes without exposing the host. Adapt the allowlist to your package registries and keep host credentials out of the container.
Read in this order
- OfficialClaude Code: Development containersStart here: what the setup does and how to adopt it.
- Open sourceClaude Code reference devcontainerThe actual firewall init script, ready to read and adapt.
- OfficialDev Container metadata referenceThe metadata fields you will edit to customize the container.