N8n and ollama in docker

n8n and ollama are running in docker. i can call them separate but there are not communicating together

Hello Cincinel,

it depends a bit on your docker setup.
I’ve put all services into one common network:

x-n8n: &service-n8n
  image: n8nio/n8n:latest
  networks: ['n8n_stack_network']
  environment:
    - OLLAMA_HOST=${COMPOSE_PROJECT_NAME}_ollama:11434

and in my .env I’ve added a variable for the hostnames:

COMPOSE_PROJECT_NAME=n8n_stack_4

If I now want to connect from n8n to Ollama, I need to enter the server address which is:

n8n_stack_4_ollama

Hey @Cincinel_Pavlenco hope all is well. Welcome to the community.

Could you please clarify how exactly they “are not communicating together”?
If ollama is running alongside n8n, from n8n you would usually reference ollama as
http://ollama:11434 or just ollama:11434.

For example, this is how my credentials screen looks like for ollama:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.