Tools
Docker Tools
Examples
- Introduction
- Getting Started
- Agents
- Teams
- Workflows
- Applications
Agent Concepts
- Multimodal
- RAG
- Knowledge
- Memory
- Async
- Hybrid Search
- Storage
- Tools
- DuckDuckGo Search
- Calculator
- Airflow Tools
- Apify Tools
- ArXiv Tools
- AWS Lambda Tools
- Baidu Search Tools
- Cal.com Tools
- Composio Tools
- Confluence Tools
- Crawl4ai Tools
- CSV Tools
- DALL-E Tools
- Desi Vocal Tools
- Discord Tools
- Docker Tools
- DuckDB Tools
- Email Tools
- E2B Code Execution
- Exa Tools
- Fal Tools
- File Tools
- Financial Datasets Tools
- Firecrawl Tools
- Giphy Tools
- GitHub Tools
- Google Calendar Tools
- Google Maps Tools
- Google Search Tools
- Hacker News Tools
- Jina Reader Tools
- Jira Tools
- Linear Tools
- Luma Labs Tools
- MLX Transcribe Tools
- Models Labs Tools
- Newspaper Tools
- Newspaper4k Tools
- OpenBB Tools
- Pandas Tools
- Postgres Tools
- PubMed Tools
- Python Tools
- Replicate Tools
- Resend Tools
- SearxNG Tools
- SerpAPI Tools
- Shell Tools
- Slack Tools
- Sleep Tools
- Spider Tools
- SQL Tools
- Tavily Tools
- Todoist Tools
- Twilio Tools
- Webex Tools
- Website Tools
- Wikipedia Tools
- X (Twitter) Tools
- YFinance Tools
- YouTube Tools
- Zendesk Tools
- Vector Databases
- Embedders
Models
- Anthropic
- AWS Bedrock
- AWS Bedrock Claude
- Azure AI Foundry
- Azure OpenAI
- Cohere
- DeepInfra
- DeepSeek
- Fireworks
- Gemini
- Groq
- Hugging Face
- Mistral
- NVIDIA
- Ollama
- OpenAI
- Perplexity
- Together
- xAI
- IBM
- LM Studio
- LiteLLM
- LiteLLM OpenAI
Tools
Docker Tools
Code
cookbook/tools/docker_tools.py
import sys
from agno.agent import Agent
try:
from agno.tools.docker import DockerTools
docker_tools = DockerTools(
enable_container_management=True,
enable_image_management=True,
enable_volume_management=True,
enable_network_management=True,
)
# Create an agent with Docker tools
docker_agent = Agent(
name="Docker Agent",
instructions=[
"You are a Docker management assistant that can perform various Docker operations.",
"You can manage containers, images, volumes, and networks.",
],
tools=[docker_tools],
show_tool_calls=True,
markdown=True,
)
# Example: List running containers
docker_agent.print_response("List all running Docker containers", stream=True)
# Example: List all images
docker_agent.print_response("List all Docker images on this system", stream=True)
# Example: Pull an image
docker_agent.print_response("Pull the latest nginx image", stream=True)
# Example: Run a container
docker_agent.print_response(
"Run an nginx container named 'web-server' on port 8080", stream=True
)
# Example: Get container logs
docker_agent.print_response("Get logs from the 'web-server' container", stream=True)
# Example: List volumes
docker_agent.print_response("List all Docker volumes", stream=True)
# Example: Create a network
docker_agent.print_response(
"Create a new Docker network called 'test-network'", stream=True
)
# Example: Stop and remove container
docker_agent.print_response(
"Stop and remove the 'web-server' container", stream=True
)
except ValueError as e:
print(f"\n❌ Docker Tool Error: {e}")
print("\n🔍 Troubleshooting steps:")
if sys.platform == "darwin": # macOS
print("1. Ensure Docker Desktop is running")
print("2. Check Docker Desktop settings")
print("3. Try running 'docker ps' in terminal to verify access")
elif sys.platform == "linux":
print("1. Check if Docker service is running:")
print(" systemctl status docker")
print("2. Make sure your user has permissions to access Docker:")
print(" sudo usermod -aG docker $USER")
elif sys.platform == "win32":
print("1. Ensure Docker Desktop is running")
print("2. Check Docker Desktop settings")
Usage
1
Create a virtual environment
Open the Terminal
and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2
Install Docker
Install Docker Desktop (for macOS/Windows) or Docker Engine (for Linux) from Docker’s official website.
3
Install libraries
pip install -U docker agno
4
Start Docker
Make sure Docker is running on your system:
- macOS/Windows: Start Docker Desktop application
- Linux: Run
sudo systemctl start docker
5
Run Agent
python cookbook/tools/docker_tools.py