Load n8n into a docker and let hermes to build and operate it all using local ollama llm 1
To achieve this ultimate local AI automation setup, you need to connect three puzzle pieces: Ollama (the brain), Hermes Agent (the operator), and n8n (the factory).
Since you now understand Docker, setting this up is just a matter of running the right containers and pointing them at each other.
Here is the step-by-step guide to building this entirely local stack:
Step 1: Set up Local Ollama (The Brain)
First, you need Ollama running on your actual computer (host machine) to serve the LLM.
- Download and install Ollama from ollama.com if you haven't already.
- Open your terminal and download a powerful local model (like Hermes 3 or Llama 3): ollama run nous-hermes2 # or whatever specific model you prefer
- Keep Ollama running in the background. By default, it runs on port 11434.
Step 2: Spin up n8n in Docker (The Factory)
Now, let's use your new Docker skills to create a persistent n8n container. Notice how we use a volume (~/.n8n) so you don't lose your workflows!
Run this command:
docker run -d --name my-n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8n
- -p 5678:5678: This maps the n8n web interface to your computer.
- Once it's running, open your web browser and go to http://localhost:5678 to set up your n8n admin account.
Step 3: Configure Hermes to use Ollama
By default, Hermes Agent might try to look for an OpenAI API key. We need to go into the volume you created earlier (~/.hermes) and tell it to look at your local Ollama instead.
- Open your ~/.hermes/config.json (or .env file, depending on the exact Hermes version) using VS Code.
- Change the LLM provider settings to point to Ollama's local server.
- Crucial Docker Detail: Because Hermes is running inside a Docker container, it cannot use localhost to find Ollama (because "localhost" to a container means inside the container).
- You must use http://host.docker.internal:11434/v1 as the Base URL. This magic address tells Docker to look at your actual computer's network.
- Set the model name to the one you downloaded (e.g., nous-hermes2).
- Set the API key to ollama (it doesn't matter what it is, but it usually can't be blank).
Step 4: Run Hermes Agent
Now, start your Hermes container just like you did before, making sure it shares the host network so it can easily see Ollama and n8n:
docker run -it --rm --name my-hermes-agent -v ~/.hermes:/opt/data --add-host=host.docker.internal:host-gateway nousresearch/hermes-agent
(The --add-host flag ensures Linux machines can resolve host.docker.internal properly. Mac/Windows Docker Desktop does this automatically).
Step 5: Connect Hermes and n8n (The Operation)
Now that everything is running locally, how do you make Hermes "operate" n8n? You use Webhooks and APIs.
- In n8n: Create a new workflow and add a Webhook Node as the trigger. n8n will give you a specific URL (e.g., http://host.docker.internal:5678/webhook/my-trigger).
- In Hermes Agent: You can give Hermes the ability to make HTTP requests (often called a Web Request Tool or REST API Tool in its config).
- The Workflow: When you text Hermes on WhatsApp saying, "Run my morning data scrape," Hermes will use its HTTP tool to send a signal to the n8n Webhook URL. n8n receives the signal, executes the complex workflow you built, and can even send an HTTP request back to Hermes with the results!
You now have a 100% private, locally hosted AI agent that can execute complex automations without sending a single byte of data to a cloud provider!