---
title: "How to Build Secure AI Coding Agents with Cerebras and Docker Compose"
description: "A containerized AI coding agent combines an ADK-Python agentic loop, a local Qwen model in Docker Model Runner for routing, Cerebras' inference API for code generation, and MCP tools served through the Docker MCP Gateway."
url: "https://swe.quest/articles/how-to-build-secure-ai-coding-agents-with-cerebras-and-docker-compose-6f4eaa03c08a3ebf"
canonical: "https://www.docker.com/blog/cerebras-docker-compose-secure-ai-coding-agents/"
source: "Docker"
published: "2025-09-17"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["ai-agents","sandboxing","containers","ai-coding","jvm"]
---

# How to Build Secure AI Coding Agents with Cerebras and Docker Compose

A post on [Docker](https://swe.quest/sources/docker.md), published 2025-09-17, 7 min read, How-to. Original: [https://www.docker.com/blog/cerebras-docker-compose-secure-ai-coding-agents/](https://www.docker.com/blog/cerebras-docker-compose-secure-ai-coding-agents/)

## Summary

A containerized AI coding agent combines an ADK-Python agentic loop, a local Qwen model in Docker Model Runner for routing, Cerebras' inference API for code generation, and MCP tools served through the Docker MCP Gateway. Generated code runs in a custom node-code-sandbox MCP server, a Quarkus/Java app that uses Testcontainers to launch a Node.js container with networking disabled. The server is registered in a custom gateway catalog with longLived: true and a sha256-pinned image. The sandbox can't exfiltrate data, while the context7 tool can still fetch docs, and Testcontainers removes sandbox containers when Compose stops.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Java & JVM](https://swe.quest/tags/jvm.md) (Languages)

## Prerequisites

- Docker Compose ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- Model Context Protocol basics
- LLM agents ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

Docker Compose, Cerebras, MCP, Docker MCP Gateway, Testcontainers, ADK-Python, Quarkus, Docker Model Runner

## Related posts

- [Highlights from AWS re:Invent: Supercharging Kiro with Docker Sandboxes and MCP Catalog](https://swe.quest/articles/highlights-from-aws-re-invent-supercharging-kiro-with-docker-sandboxes-and-mcp-a18d4753910b06e8.md): Docker · 2025-12-12 · Medium · 7 min read · AI agents, Sandboxing & isolation, Containers, AI for coding
  Docker Sandboxes run coding agents like AWS's Kiro inside isolated containers that see only the project directory and none of the host's credentials, while the Docker MCP Toolkit supplies tools through a gateway that injects secrets only into the specific MCP server that needs them.
- [Running AI agents in GitHub Actions with Docker Sandboxes](https://swe.quest/articles/running-ai-agents-in-github-actions-with-docker-sandboxes-9cf9181798d75585.md): Docker · 2026-08-21 · Medium · 7 min read · AI agents, Sandboxing & isolation, CI/CD, Virtualization, AI for coding
  GitHub Agentic Workflows (gh-aw 0.82.9) supports Docker Sandboxes (sbx) as an agent runtime, so a CI coding agent gets root, sudo and unrestricted shell inside a disposable microVM with its own kernel and private Docker daemon.
- [Why AI Agents Need Isolation](https://swe.quest/articles/why-ai-agents-need-isolation-2e7b1a6342af3236.md): Docker · 2026-07-01 · Easy · 9 min read · Sandboxing & isolation, AI agents, Virtualization, Containers, AI for coding
  AI coding agents that run commands, install packages and handle credentials should execute behind an isolation boundary rather than directly on the developer's host.
- [Building AI Teams: How Docker Sandboxes and Docker Agent Transform Development](https://swe.quest/articles/building-ai-teams-how-docker-sandboxes-and-docker-agent-transform-development-50a60f5e32d42807.md): Docker · 2026-03-11 · Medium · 9 min read · AI agents, Sandboxing & isolation, Containers, AI for coding, Virtualization
  Docker Agent defines teams of specialized AI agents in YAML, where a root "product manager" agent delegates to designer, engineer, QA and fixer sub-agents, each with its own model, instructions and toolsets (filesystem, shell, think, todo, memory, MCP).
- [The Untrusted Autonomous Workload: How AI Coding Agents Reshape What Isolation Has to Do](https://swe.quest/articles/the-untrusted-autonomous-workload-how-ai-coding-agents-reshape-what-isolation-af433bee97ff8809.md): Docker · 2026-05-26 · Medium · 16 min read · Sandboxing & isolation, Virtualization, AI agents, Containers, Supply chain security
  AI coding agents are untrusted, autonomous workloads that containers were never designed to isolate, so Docker Sandboxes runs each agent in a microVM (custom VMM on Hypervisor.framework, WHP or KVM) with its own kernel and private Docker Engine.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
