ai newsDi., 1. Dez.

Build AI Agents Without Code: Run Docker Agent via YAML and Connect Local Models Without API Keys

Originally published on VGoods Lab . This article is compiled based on Docker's official repository, documentation, and example directories (verified on October 8, 2026). In a nutshell: Docker's official open-source agent runtime tool (Apache-2.0). Define your models, instructions, and tools in a s

dev.toMontag 08:59 · 30.11.5 Min. Lesezeit
Bild: dev.to

Posted on Nov 30 • Originally published at vgoodslab.com

This article is compiled based on Docker's official repository, documentation, and example directories (verified on October 8, 2026).

In a nutshell: Docker's official open-source agent runtime tool (Apache-2.0). Define your models, instructions, and tools in a single YAML file, spin it up with a simple docker agent run command, and seamlessly connect to either cloud models or local models via Docker Model Runner—meaning no API keys required and zero data leaves your local machine.

Usually, when you want an LLM to read files, execute commands, or fetch data by stitching together your own framework, the workflow looks like this: pick an SDK, write JSON schemas for your tools, code the orchestration logic, implement chat loops, and handle streaming outputs. Change the model, and all that glue code needs a rewrite. Want to share your shiny new agent with someone else? They have to painstakingly clone a README and set up an environment.

Docker Agent takes a completely different path: Configuration over code. The official stance is straightforward—it wants running an AI agent to feel just like spinning up a container with docker run. Definition, execution, and distribution all follow your familiar workflows.

It acts as a great complement to tools we've covered previously: Agent Reach solves the "blind spot" of agents lacking internet access, while Docker Agent tackles how agents are built, run, and shared. Its built-in document retrieval capabilities also contrast with dedicated knowledge base platforms like WeKnora —where one is a general-purpose runtime framework with search features, and the other is purpose-built solely for knowledge bases.

docker agent --help docker agent doctor Enter fullscreen mode Exit fullscreen mode The second command is the official health check utility: it reports credential statuses for various model services, checks if the local Model Runner is reachable, and lists currently pulled models. Fix any issues here before you start tweaking your YAML files.

docker model status --json docker model pull ai/qwen3 docker model ls Enter fullscreen mode Exit fullscreen mode The first command confirms the Model Runner is active, and the latter two pull and inspect your local models. According to the official documentation, if no cloud API key is configured, running an agent will automatically prioritize locally pulled models.

For the cloud route, the minimal setup requires declaring the model, description, instructions, and toolsets:

agents: root: model: anthropic/claude-sonnet-4-5 description: A coding assistant instruction: You are an expert developer. toolsets: - type: filesystem - type: shell Enter fullscreen mode Exit fullscreen mode For the local route, just change the model line while keeping the rest of the structure intact:

agents: root: model: dmr/ai/qwen3 description: A local assistant instruction: You are a helpful assistant. toolsets: - type: filesystem Enter fullscreen mode Exit fullscreen mode If you want to add search tools, simply append an MCP toolset—such as the containerized DuckDuckGo MCP service referenced in the official README. Always store API keys in environment variables rather than hardcoding them into your YAML, a best practice heavily emphasized in official documentation.

docker agent run docker agent run agent.yaml docker agent run --exec agent.yaml "Help me analyze this error log" cat error.log | docker agent run --exec agent.yaml "Where is the bug in this log?" Enter fullscreen mode Exit fullscreen mode Running without arguments drops you into an interactive session. Adding --exec performs a one-off task, perfect for embedding into scripts. You can also use docker agent new to interactively bootstrap a new configuration file if you aren't sure where to start. The official examples directory contains hundreds of ready-to-use configurations—covering single agents, multi-agent teams, document retrieval, MCP integrations, and permission sandboxes. Copying and tweaking an existing sample is infinitely faster than starting from a blank file.

A: First, ensure your Docker Desktop version is up to date (the plugin is only pre-installed in version 4.63+). If you installed the standalone binary, make sure the executable is placed in Docker's plugin directory or run it as a standalone command.

Q: Cannot connect to the local model / getting an empty endpoint error?

A: Check these sequentially: Is the Model Runner feature enabled? Does docker model status --json return normally? Is your active Docker context pointing to the local engine? Official troubleshooting docs note that if a connection fails, it won't silently fallback to another local runner; the error message will explicitly specify the connection name to help you debug.

Q: Local small models fail to use tools or give irrelevant answers?

A: This is almost certainly a model capability limitation rather than a configuration bug. Tool calling requires robust reasoning skills. Start by verifying simple text-only configurations without toolsets on smaller models, and gradually add toolsets later. Alternatively, offload critical agents to cloud models and keep local models scoped to non-sensitive sub-tasks.

Q: Can I connect my own documents for Q&A?

A: Yes. The built-in retrieval toolsets support keyword search, vector search, hybrid search, and reranking strategies. Complete document Q&A configs can be found in the examples directory. However, if your primary core requirement is an enterprise-grade knowledge base platform, a dedicated system is still a better choice; the search features in general-purpose frameworks are designed to be "good enough."

Q: Is giving an agent shell tool access safe?

A: This is arguably the riskiest feature and demands extreme caution. The official examples include dedicated safety modes and sandbox configurations: file access can be restricted via allow/deny lists, and shell commands can be executed inside containerized sandboxes. The golden rule: Grant only the minimum permissions required to complete the task —don't expose your entire disk and allow arbitrary commands just for the sake of convenience.

Quelle: dev.to (dev.to). Original öffnen