Skip to content

Instantly share code, notes, and snippets.

@badlydrawnrod
Created February 22, 2026 00:17
Show Gist options
  • Select an option

  • Save badlydrawnrod/84a14200c02c396bd34a970848c508ca to your computer and use it in GitHub Desktop.

Select an option

Save badlydrawnrod/84a14200c02c396bd34a970848c508ca to your computer and use it in GitHub Desktop.

Running Agent-C in a Docker sandbox

These instructions are for a Windows host, and assume that you're using Ollama. If you aren't using Ollama then there's no need to do any of the proxy stuff.

Start Ollama in the host

Ensure ollama is running in the host.

$env:OLLAMA_CONTEXT_LENGTH = 65536
ollama serve

Create the shell sandbox

Create an empty workspace directory. The name doesn't really matter, as it's just a placeholder for the template.

mkdir my-workspace

Create a shell sandbox.

docker sandbox create --name agentc-template shell .\my-workspace

Configure the proxy so that the sandbox can see Ollama.

docker sandbox network proxy agentc-template --policy allow --allow-host localhost:11434

Run it.

docker sandbox run agentc-template

Check that ollama is visible.

curl host.docker.internal:11434

You should see Ollama is running.

Install Agent-C

Install Agent-C.

uv tool install git+https://github.com/badlydrawnrod/agent-c

Append the following to .bashrc.

# Run Agent-C if the shell is interactive.
if [[ $- == *i* ]]
then
    export OLLAMA_HOST=http://host.docker.internal:11434/v1
    uv tool run agent-c
fi

You may not have an editor in the sandbox, so one option is to copy .bashrc to the mounted my-workspace directory, edit it from the host, then copy it back.

Exit the sandbox, then re-run it to check that Agent-C starts.

docker sandbox run agentc-template

When the Agent-C prompt appears, enter something simple such as "What is the current directory?" You should get something sensible back.

Exit from Agent-C by pressing Ctrl+Q, then exit the sandbox.

Snapshot the sandbox into a Docker image

Once back in the host, save the template as a Docker image.

docker sandbox save agentc-template agentc-python-sandbox:v1

If you get an error saying that the host Docker is not available then you'll need to start it first.

Creating an Agent-C sandbox from the template

To use the sandbox, first create it from your template, passing it the path of the directory to mount.

docker sandbox create -t agentc-python-sandbox:v1 shell C:\Projects\python\agent-c

Once it has been created, configure the proxy so that it can see Ollama. This is a one-off configuration for this sandbox.

docker sandbox network proxy shell-agent-c --policy allow --allow-host localhost:11434

Running the new sandbox

Finally, run it.

docker sandbox run shell-agent-c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment