Skip to main content
Build and deploy agents as Docker containers using praisonai deploy run --type docker.

CLI

pip install praisonai
export OPENAI_API_KEY="your-key"

# Initialize with Docker deploy config
praisonai deploy init --file agents.yaml --type docker

# Deploy to Docker
praisonai deploy run --file agents.yaml --type docker
Expected Output:
🚀 Starting deployment...

📦 Building Docker image: praisonai-app:latest
  • Base image: python:3.11-slim
  • Exposing ports: [8005]

✅ Deployment successful!
🔗 URL: http://localhost:8005

Metadata:
  • type: docker
  • image: praisonai-app:latest
  • container_id: abc123def456
Verify:
docker ps | grep praisonai
curl http://localhost:8005/health

Python

from praisonai.deploy import Deploy, DeployConfig, DeployType
from praisonai.deploy.models import DockerConfig

config = DeployConfig(
    type=DeployType.DOCKER,
    docker=DockerConfig(
        image_name="praisonai-app",
        tag="latest",
        base_image="python:3.11-slim",
        expose=[8005],
        push=False
    )
)

deploy = Deploy(config, "agents.yaml")
result = deploy.deploy()

print(f"Image: {result.metadata.get('image')}")
print(f"Container: {result.metadata.get('container_id')}")

agents.yaml

framework: praisonai
topic: helpful assistant
roles:
  assistant:
    role: Assistant
    goal: Help users with their questions
    backstory: You are a helpful assistant
    tasks:
      help_task:
        description: Answer user questions
        expected_output: Helpful response

deploy:
  type: docker
  docker:
    image_name: "praisonai-app"
    tag: "latest"
    base_image: "python:3.11-slim"
    expose: [8005]
    push: false
    registry: null

Docker Config Options

FieldTypeDefaultDescription
image_namestringpraisonai-appDocker image name
tagstringlatestDocker image tag
base_imagestringpython:3.11-slimBase Docker image
exposelist[int][8005]Ports to expose
registrystringnullDocker registry URL
pushboolfalsePush image to registry
build_argsdictnullDocker build arguments

Push to Registry

Push the built image to a Docker registry:
deploy:
  type: docker
  docker:
    image_name: "praisonai-app"
    tag: "v1.0.0"
    registry: "your-registry.com/your-org"
    push: true
praisonai deploy run --file agents.yaml --type docker
Expected Output:
🚀 Starting deployment...

📦 Building Docker image: your-registry.com/your-org/praisonai-app:v1.0.0
📤 Pushing to registry: your-registry.com/your-org

✅ Deployment successful!

Metadata:
  • image: your-registry.com/your-org/praisonai-app:v1.0.0
  • pushed: true

Check Status

praisonai deploy status --file agents.yaml

Stop Container

praisonai deploy destroy --file agents.yaml
Expected Output:
⚠️  Warning: This will destroy the deployment!
File: agents.yaml
Service: praisonai-app

Type 'yes' to confirm destruction: yes

🗑️ Destroying deployment...

✅ Deployment destroyed successfully

Deleted resources:
  • container: praisonai-app-abc123
  • image: praisonai-app:latest (local)

Troubleshooting

IssueFix
Docker not runningStart Docker daemon
Build failedCheck Dockerfile syntax, run praisonai deploy doctor
Push failedCheck registry credentials
Port in useChange port in agents.yaml
These commands are for manual validation only. Use praisonai deploy for deployment.
# Build manually
docker build -t praisonai-app:latest .

# Run manually
docker run -p 8005:8005 -e OPENAI_API_KEY=$OPENAI_API_KEY praisonai-app:latest

# Check logs
docker logs <container_id>

# Stop
docker stop <container_id>