Volumes, ports and env vars¶
Give a run extra mounts, ports and env vars. Each flag has a matching [run] key in .agenticrc.toml. For the mounts agentic adds itself, see Volume mounts.
Volumes¶
--volume takes a bind mount (host/path:container/path) or a named volume (name:container/path). Named volumes are created on first use and persist across runs. Paths support placeholders.
agentic run -v 'maven:$CONTAINER_HOME/.m2' claude # named volume, read-write
agentic run -v '~/notes:/notes' claude # bind mount, read-only
agentic run -v '~/.m2:$CONTAINER_HOME/.m2:rw' claude # bind mount, writable
- Bind mounts are read-only unless you add
:rw. Other Docker options can follow it (:rw,z). - Named volumes,
/workspaceand the tool's own state directories are always writable.
To keep part of the workspace read-only, mount it over itself:
agentic run -v '$PWD/.git:/workspace/.git' claude
Manage volumes with agentic volume:
agentic volume create maven
agentic volume list # alias: ls, or agentic volumes
agentic volume remove maven # alias: rm
agentic volume remove --all # remove all agentic volumes
With the microsandbox runtime, msb stores the volume as agentic-<name>. list and remove cover these too; create is Docker-only.
Forwarding ports¶
--port forwards a port on your machine to the tool, for example to open a dev server the agent started. It takes PORT or HOST:GUEST, optionally with /tcp, and can be repeated.
agentic run --port 3000 claude # localhost:3000 -> 3000 in the tool
agentic run --port 8080:5173 --port 4200 claude
- TCP only, bound to
127.0.0.1. - The server in the tool must listen on
0.0.0.0, notlocalhost. For Vite, that'svite --host. - Pages you open from a forwarded port run in your browser. See Leftover risk.
- A run refuses a host port that's already in use, and Docker refuses ports on a remote Docker context.
- Docker can't forward ports with
--proxy. Pass--no-proxyor use the microsandbox runtime. - On Docker, ports that
--dindcontainers publish stay inside the run. To open one, the agent relays a forwarded port to it; the environment instructions tell it how. agentic pslists each run's forwarded ports.
Environment variables¶
-e/--env sets KEY=VALUE, or forwards the host value with a bare KEY (skipped if unset):
agentic run -e NODE_OPTIONS=--max-old-space-size=4096 claude
agentic run -e CI claude
- Values are visible inside the container and in
docker inspect. Use credential injection for API keys. TZand the terminal vars (COLORTERM,TERM,TERM_PROGRAM,TERM_PROGRAM_VERSION,NO_COLOR,FORCE_COLOR) are forwarded from the host automatically. Override them like any other var (-e TZ=UTC).
Names agentic manages are refused:
| Names | Reserved |
|---|---|
TOOL_HOME, CONTAINER_HOME, AGENTIC_MARKETPLACES, AGENTIC_PROXY_CA |
Always |
HTTP_PROXY, HTTPS_PROXY, NODE_USE_ENV_PROXY and the other proxy vars |
With --proxy |
DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, DOCKER_CONFIG, DOCKER_CONTEXT |
With --dind |
AGENTIC_MAVEN_PROXY_*, GRADLE_OPTS |
With the maven and gradle proxy integrations |
| The CA trust vars | With credential injection or path rules |
Each credential entry's env names |
With credential injection |
GH_HOST |
With a credential host |