Source Code:
src/gaia/agents/docker/agent.py · src/gaia/apps/docker/app.pyOverview
The GAIA Docker Agent provides a natural language interface for containerizing applications. The agent analyzes your application structure, generates appropriate Dockerfiles, and provides guidance for building and running containers - all through conversational commands. No Docker expertise required.First time here? Complete the Setup guide first to install GAIA and its dependencies.
Quick Start
Prerequisites
- Docker Installation (Required): Docker Engine or Desktop: Download from docker.com
-
GAIA Installation:
Follow the Setup guide, then install with MCP extras:
-
Download Required Model:
The Docker agent uses the
Qwen3-Coder-30B-A3B-Instruct-GGUFmodel for reliable Dockerfile generation and application analysis. Use the Lemonade server’s model manager to download it:- Start Lemonade server with extended context size:
lemonade-server serve --ctx-size 8192 - Open the model manager in your browser (typically http://localhost:8000)
- Search for and download:
Qwen3-Coder-30B-A3B-Instruct-GGUF
- Start Lemonade server with extended context size:
Verify Installation
Check Docker is installed:Basic Usage
Generate Dockerfile for your application:Architecture Overview
Key Components
-
DockerAgent (
src/gaia/agents/docker/agent.py)- Core agent that processes natural language queries
- Analyzes application structure and dependencies
- Uses LLM to generate appropriate Dockerfiles
- Registers four main tools:
analyze_directory,generate_dockerfile,build_image,run_container
-
DockerApp (
src/gaia/apps/docker/app.py)- Application wrapper for the DockerAgent
- Provides CLI interface and user interaction
- Formats output for user display
- Displays next steps after Dockerfile generation
-
GAIA Docker CLI (
gaia dockercommand)- Easy command-line interface for Docker operations
- Supports natural language queries with directory context
- Automatically manages agent lifecycle
- No coding required - just describe what you need
How It Works
- Directory Analysis: Scans application structure, detects frameworks, identifies dependencies
- Context Building: Creates detailed application context for the LLM
- Natural Language Processing: LLM interprets user intent and requirements
- Dockerfile Generation: Creates appropriate Dockerfile with best practices
- Next Steps Guidance: Provides build and run commands
Usage Examples
Natural Language Commands
command parameter accepts natural language instructions. The agent can:
- Create just a Dockerfile (analyzes app, generates and saves Dockerfile)
- Build the Docker image (if you ask it to build)
- Run the container (if you ask it to run)
- Or do all three steps in sequence
GitHub Copilot Integration
Use GAIA Docker directly within GitHub Copilot for seamless containerization assistance in your IDE.Prerequisites
-
Start Lemonade Server with Extended Context:
Note: The extended context size is required for handling complex Docker queries through Copilot.
-
Start GAIA MCP Bridge:
-
Configure VSCode MCP Settings:
Add to your VSCode
mcp.json(typically in.vscode/mcp.json): - Restart VSCode to load the MCP configuration
Usage with Copilot
Once configured, you can reference GAIA Docker in your Copilot prompts using#gaia-docker:
Workflow
- MCP Bridge: Acts as the intermediary between VSCode/Copilot and GAIA agents
- Context Awareness: The agent can access your project files and dependencies
- Interactive Generation: Copilot presents the Dockerfile and next steps inline
- Iterative Refinement: Continue the conversation to adjust the Dockerfile as needed
Integration Methods
1. Python API (Direct Integration)
2. MCP Server (HTTP/JSON-RPC Integration)
GAIA’s MCP support is powered by FastMCP from the Model Context Protocol Python SDK. The server uses FastMCP’s “streamable-http” transport, providing both HTTP POST and SSE streaming at the/mcp endpoint.
Start the Docker MCP Server:
- The MCP interface currently performs the complete workflow: analyze → create Dockerfile → build image → run container
- This is ideal for automation tools that need full containerization in a single operation
- Future versions will support more granular control (e.g., just creating Dockerfile without building)
- For granular control now, use the CLI interface which supports individual operations
- MCP Documentation - Complete MCP bridge reference
- n8n Integration Guide - Workflow automation examples
Key Features
Automatic Application Analysis
The agent automatically detects:- Framework identification (Flask, Django, FastAPI, etc.)
- Python version requirements
- Dependencies from requirements.txt or pyproject.toml
- Application structure and entry points
- Port requirements for web applications
Intelligent Dockerfile Generation
The agent generates Dockerfiles that include:- Appropriate base images (Python official images)
- Dependency installation (pip install from requirements.txt)
- Working directory setup
- Application file copying
- Port exposure for web apps
- Runtime commands (ENTRYPOINT or CMD)
- Best practices (non-root user, layer optimization)
Multi-Step Workflow
The agent orchestrates a complete containerization workflow:- Analyze: Scan application directory and identify structure
- Generate: Create appropriate Dockerfile
- Validate: Check Dockerfile syntax and completeness
- Guidance: Provide next steps for build and run
Next Steps Guidance
After Dockerfile generation, the agent provides:- Build command with appropriate image tag
- Run command with port mappings and necessary flags
- Contextual tips based on application type
Command Reference
Basic Command Structure
command is a natural language instruction that tells the agent what Docker operations to perform (e.g., “create a Dockerfile”, “build and run my app”).
Available Options
| Option | Type | Default | Description |
|---|---|---|---|
command | string | Required | Natural language instruction (positional argument). Can request Dockerfile creation, building, running, or all three. |
-d, --directory | string | . | Directory containing the application to containerize |
-v, --verbose | flag | - | Enable verbose output |
--debug | flag | - | Enable debug logging |
--model | string | Qwen3-Coder-30B-A3B-Instruct-GGUF | LLM model to use |
Troubleshooting
Common Issues and Solutions
”Docker Not Installed”
Check Docker installation:”Lemonade Server Not Running”
Start the Lemonade server:“No Dockerfile Generated”
If the agent doesn’t generate a Dockerfile:- Check that your application has identifiable structure (e.g., requirements.txt, app.py)
- Ensure the Lemonade server is running
- Try a more specific query describing your application type
- Check the agent logs for error messages
”Model Not Found”
Verify the Qwen3-Coder model is downloaded:- Open Lemonade UI: http://localhost:8000
- Check Models section for Qwen3-Coder-30B-A3B-Instruct-GGUF
MCP Integration Issues
Check if MCP bridge is running:Debug Mode
For detailed troubleshooting, check the agent logs. Logs are written to gaia.log:Best Practices
- Organize Application: Include requirements.txt/pyproject.toml, clear entry point (app.py), logical structure
- Review Output: Verify base image, dependencies, ports, and runtime commands before building
- Test Incrementally: Generate → Review → Build → Test container in sequence
- Use Natural Language: When using GitHub Copilot integration, simple queries like
"use #gaia-docker with my app"work well
Limitations
Current limitations of the Docker agent:- Single-language support: Primarily focused on Python applications
- Simple configurations: Best for straightforward containerization scenarios
- No multi-stage builds: Generated Dockerfiles use single-stage builds
- Limited customization: Advanced Docker features may require manual editing
- No docker-compose: Does not generate docker-compose.yml files
Testing Your Integration
Quick Python Test:See Also
- GAIA CLI Documentation - Full command line interface guide
- MCP Server Documentation - External integration details
- Jira Agent Documentation - Natural language Jira operations
- Blender Agent Documentation - 3D content creation
- Features Overview - Complete GAIA capabilities