Cerebras and Docker Compose: Building Isolated AI Code Environments September 17, 2025

Try it Yourself: Instructions

DevDuck is easy to try for yourself. First, make sure that you have Docker installed, which you can download from the official website.

Next, open a terminal and run the following commands:

“git clone https://github.com/shelajev/docker-cerebras-demo

Once you’ve cloned the repository, the final step is to establish your environment. DevDuck uses two models: one local model and one Cerebras inference model. To use the system, enter your Cerebras API key into the .env file, which you can obtain from the Cerebras platform.

All that’s left to do is run the program. To build and start DevDuck, run:

“docker compose up --build”

The compose setup spins up our agents and Docker's MCP gateway which manages, in this example, the MCP tools for working with the node sandbox containers.

You can initialize the sandbox with a single prompt. DevDuck has three separate agents, but the Cerebras agent does most of the heavy lifting and tool calling.

To initialize the sandbox, or use any tool, simply ask for any task and the program will automatically navigate to the correct agent and take care of everything else. Here, the DevDuck agent automatically hands off to Cerebras, which then sets up the Docker Compose sandbox in seconds. You can say:

“Initialize the sandbox”

“Hey Cerebras, init the sandbox”

“Please initialize my container. Thank you!”

With Compose, we can easily host multiple containers. So, our agents can easily switch between each other and call tools with no extra work on your part. With Cerebras inference, expect sandbox initializations, file creation, and code generation to be done in seconds.

When Cerebras agent has access to a sandbox, it can generate and run code in it. This particular example configures the sandbox to not have network access, which improves security posture of the whole setup.

Beyond DevDuck

Altogether, Cerebras inference and Docker Compose together provide a fast, isolated, and reproducible environment for AI-generated code. Developers can run local models alongside Cerebras agents, enabling hybrid workflows that balance speed, cost, and safety. Systems like DevDuck demonstrate how this setup allows code generation, execution, and testing to happen reliably and at scale.

Try Cerebras inference and Docker Compose yourself. Sign up for a Cerebras API key here, and get Docker Compose here.