Deployment Docker Guide

Deploying agents on a server, the simple way

Your agent works on your laptop. Now it needs to run on a server, all day, and survive restarts. One tool matters most: Docker. This guide explains it in plain words and ships a full agent stack with one command.

APFlow
Blog · June 2026 · 8 min read
Shipping containers from above, neatly stacked
Photo: Logan Voss, Unsplash
TL;DR
  • ·Docker packages your agent with everything it needs into a container: it runs the same on your laptop and on the server. This is the single most important deployment tool.
  • ·Docker Compose describes your whole stack (model server, workflow engine, database) in one file, and `docker compose up -d` starts everything.
  • ·Not a terminal person? Portainer gives you a visual dashboard over Docker: start, stop, and inspect everything from the browser.

An agent that runs on your laptop is a demo. An agent that runs on a server, restarts itself after a crash, and keeps working while you sleep is a system. The gap between the two is deployment, and in 2026 the path is far simpler than it looks: almost everything reduces to Docker plus one configuration file. This guide keeps it that simple.

Why Docker is the one tool that matters

The oldest problem in software is "it works on my machine". Your agent needs Python 3.12, four libraries, a model server, and a database, and the server has none of them. Docker solves this by packaging the application and everything it needs into a container: a sealed box that runs identically anywhere Docker is installed. You build the box once; the server just runs it. That is the entire idea, and it is why Docker is the default skill to learn before any other deployment tool.

The supporting cast

Docker Compose
Your whole stack in one file
What it does Describes every service (agent, model, database) in one YAML file
Why it matters One command starts, stops, and restarts everything together
Portainer
Docker without the terminal
What it does A browser dashboard over your containers: logs, restarts, updates
Why it matters Lets non-terminal people operate the server safely
Ollama
The model server in the stack
What it does Serves your local model on port 11434 for every agent to call
Why it matters Runs as a container next to the rest, GPU passed through
n8n (self-hosted)
The workflow engine, also a container
What it does Runs your visual agent workflows on the server, on schedule or on trigger
Why it matters The non-coder's whole orchestration layer in one image

A full agent stack in one file

Here is the smallest honest example: a model server and a workflow engine, wired together, surviving reboots. Save it as docker-compose.yml on the server and run one command. This is genuinely how small the core of a deployment is.

docker-compose.yml
services:
  ollama:
    image: ollama/ollama
    volumes: ["ollama:/root/.ollama"]
    restart: unless-stopped

  n8n:
    image: n8nio/n8n
    ports: ["127.0.0.1:5678:5678"]
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
    volumes: ["n8n:/home/node/.n8n"]
    restart: unless-stopped

volumes:
  ollama:
  n8n:
Start everything
docker compose up -d

# see what is running
docker compose ps

# read the logs of one service
docker compose logs n8n -f

Note the two quiet safety choices in that file: restart: unless-stopped brings every service back after a crash or reboot, and the n8n port is bound to 127.0.0.1, so it is reachable only from the server itself, not from the internet. You then access it through a VPN or an SSH tunnel. Those two lines prevent the two most common beginner disasters.

When you outgrow this

One server with Compose carries most teams surprisingly far. You will know you have outgrown it when you need many servers, zero-downtime updates, or autoscaling; that is when Kubernetes enters. Do not start there. Start with one machine, one file, one command, and a backup of your volumes.

Share

Put one workflow into production.

A 15-minute call, then a real assessment of what an agent can run on your own servers.

Book a scoping call →
Keep reading