Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
Ubuntu 24.04 Docker Network Guide: n8n, Ollama, Open WebUI and localhost
Docker Network, n8n, Ollama and Open WebUI

Ubuntu 24.04 Docker Network Guide: Why n8n, Ollama and Open WebUI Cannot Use localhost Between Containers

This guide isolates the Docker networking layer of our real Ubuntu 24.04.4 LTS n8n + Ollama + Open WebUI deployment. It explains the eka-ai user-defined bridge, container-name DNS, the difference between host 127.0.0.1 and container localhost, real n8n → Ollama and Open WebUI → Ollama connectivity tests, and localhost-only host bindings for ports 11434, 3000 and 5678.

Ubuntu 24.04Docker NetworkDocker BridgeUser Defined BridgeDocker DNSlocalhost containern8n OllamaOpen WebUI Ollamaeka-aiDocker networking1143456783000EKA Sunucu
Ollama / Qwen3 / Open WebUI / Ubuntu 24.04
Ubuntu 24.04 Docker Host
  ├─ n8n        ─┐
  ├─ Open WebUI ├─ eka-ai ─→ ollama:11434
  └─ Ollama     ─┘

Host → 127.0.0.1:11434
Container → http://ollama:11434
Ollama0.32.6Open WebUI0.11.0 test
13real WebP screenshots
3TR · EN · DE content
443public HTTPS
127.0.0.1AI service loopback
01eka-ai user-defined bridge
02Docker DNS / container names
03container localhost behavior
04localhost-only port binding
00
Table of contents

Ubuntu 24.04 Docker network and container communication steps

  1. 01Why do n8n, Open WebUI and Ollama share the same Docker network?
  2. 02Create a project-specific user-defined bridge instead of relying on the default bridge
  3. 03Verify attached containers with docker network inspect
  4. 04Why does localhost inside one container not point to another container?
  5. 05Use 127.0.0.1 from the host and the ollama hostname from containers
  6. 06Verify Ollama model listing and a real chat request from the n8n container
  7. 07Use OLLAMA_BASE_URL=http://ollama:11434 in Open WebUI
  8. 08Keep host ports on 127.0.0.1 while containers communicate privately
  9. 09Use docker network connect to attach an existing running container to eka-ai
  10. 10Troubleshoot connection refused and Docker DNS problems layer by layer
  11. 11Keep create, connect, inspect, DNS and HTTP checks in one command set
  12. 12Re-check network membership and port bindings after reboots and container upgrades
01
Real test architecture

Why do n8n, Open WebUI and Ollama share the same Docker network?

In our real Ubuntu 24.04 test stack, Ollama, Open WebUI and n8n run as separate Docker containers. We created a user-defined bridge network named eka-ai so the services can reach one another by container name.

This allows private service-to-service communication without publishing every port. n8n and Open WebUI reach Ollama at http://ollama:11434, while host-side tests use http://127.0.0.1:11434.

Command 1
n8n        → eka-ai → ollama:11434
Open WebUI → eka-ai → ollama:11434
Host       → 127.0.0.1:11434
02
User-defined bridge

Create a project-specific user-defined bridge instead of relying on the default bridge

Docker user-defined bridge networks provide name-based container communication and better isolation for a project. Grouping the AI services under eka-ai gives the stack a clearer network boundary.

Create eka-ai when it does not exist. If the network already exists, inspect the current network instead of recreating it.

Command 1
docker network create eka-ai
Command 2
docker network ls
03
Attached services

Verify attached containers with docker network inspect

The network existing is not enough; the communicating containers must actually be attached to it. docker network inspect shows members and Docker-assigned addresses.

Container IPs can change, so use Docker DNS names such as ollama instead of hard-coding 172.x.x.x addresses in application settings.

Command 1
docker network inspect eka-ai
Command 2
docker inspect ollama --format '{{json .NetworkSettings.Networks}}'
docker inspect n8n --format '{{json .NetworkSettings.Networks}}'
docker inspect open-webui --format '{{json .NetworkSettings.Networks}}'
04
Common mistake

Why does localhost inside one container not point to another container?

From inside the n8n container, http://localhost:11434 refers to the n8n container itself, not the Ollama container. Separate containers therefore cannot find each other through localhost just because they run on the same Docker host.

On a shared user-defined network, Docker DNS resolves container names. If the Ollama container is named ollama, the correct address from n8n or Open WebUI is http://ollama:11434.

Command 1
Wrong:   http://localhost:11434
Command 2
Correct: http://ollama:11434
05
Two address patterns

Use 127.0.0.1 from the host and the ollama hostname from containers

The correct address depends on where the client runs. In the SSH shell, localhost refers to the Docker host. Inside a container, localhost belongs to that container's own network namespace.

Our real setup used 127.0.0.1:11434 for host-side Ollama tests and ollama:11434 for n8n and Open WebUI integrations.

Command 1
curl -sS http://127.0.0.1:11434/api/tags
Command 2
docker exec n8n node -e "fetch('http://ollama:11434/api/tags').then(r=>r.text()).then(console.log)"
06
Real n8n test

Verify Ollama model listing and a real chat request from the n8n container

Testing the network directly from the n8n container before configuring AI nodes simplifies troubleshooting. In our real test n8n reached http://ollama:11434/api/tags with HTTP 200 and found qwen3:4b.

We then sent a real /api/chat request from the n8n container and received N8N-OLLAMA-BAGLANTISI-BASARILI. That proved later credential or node errors were not Docker-network failures.

Command 1
docker exec n8n node -e "fetch('http://ollama:11434/api/tags').then(r=>r.json()).then(j=>console.log(JSON.stringify(j)))"
Command 2
docker exec n8n node -e "fetch('http://ollama:11434/api/chat',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({model:'qwen3:4b',messages:[{role:'user',content:'Write only N8N-OLLAMA-BAGLANTISI-BASARILI.'}],stream:false})}).then(r=>r.json()).then(j=>console.log(j.message.content))"
07
Open WebUI integration

Use OLLAMA_BASE_URL=http://ollama:11434 in Open WebUI

Open WebUI runs in a different container from Ollama, so it also uses the Docker network name rather than host localhost. Our deployment set OLLAMA_BASE_URL=http://ollama:11434.

That allowed Open WebUI to list qwen3:4b without exposing Ollama port 11434 publicly.

Command 1
OLLAMA_BASE_URL=http://ollama:11434
Command 2
docker network connect eka-ai open-webui
docker network connect eka-ai ollama
08
Port security

Keep host ports on 127.0.0.1 while containers communicate privately

A user-defined network solves private container communication, while host port publishing is a separate security decision. We bound Ollama 11434, Open WebUI 3000 and n8n 5678 only to 127.0.0.1.

Public users reached Open WebUI and n8n through Nginx HTTPS. The Ollama API was not published publicly.

Command 1
-p 127.0.0.1:11434:11434
Command 2
-p 127.0.0.1:3000:8080
Command 3
-p 127.0.0.1:5678:5678
Command 4
ss -lntp | grep -E ':11434|:3000|:5678'
09
Attach a running container

Use docker network connect to attach an existing running container to eka-ai

If you forgot --network eka-ai when starting a container, you do not necessarily need to recreate it. Docker supports attaching running containers to user-defined networks.

After connecting, inspect membership, test Docker DNS with getent hosts and finally perform a real HTTP request.

Command 1
docker network connect eka-ai n8n
Command 2
docker network connect eka-ai open-webui
Command 3
docker network inspect eka-ai
Command 4
docker exec n8n getent hosts ollama
10
Troubleshooting

Troubleshoot connection refused and Docker DNS problems layer by layer

First verify both containers share the same user-defined network. Next test whether the hostname ollama resolves through Docker DNS. If DNS works but HTTP fails, inspect the target service port and logs.

If host-side 127.0.0.1:11434 works but n8n cannot reach ollama:11434, the likely problem is network membership or Docker DNS. If both fail, investigate the Ollama runtime.

Command 1
docker network inspect eka-ai
Command 2
docker exec n8n getent hosts ollama
Command 3
docker exec n8n node -e "fetch('http://ollama:11434/api/tags').then(r=>console.log(r.status)).catch(console.error)"
Command 4
docker logs --tail 100 ollama
11
Quick reference

Keep create, connect, inspect, DNS and HTTP checks in one command set

A small set of commands covers most Docker-network problems: create or confirm the network, attach containers, inspect membership, test DNS and then make a real HTTP request.

These commands summarize the network model used by our n8n + Ollama + Open WebUI stack.

Command 1
docker network create eka-ai
Command 2
docker network connect eka-ai n8n
docker network connect eka-ai open-webui
docker network connect eka-ai ollama
Command 3
docker network inspect eka-ai
Command 4
docker exec n8n getent hosts ollama
Command 5
docker exec n8n node -e "fetch('http://ollama:11434/api/tags').then(r=>r.text()).then(console.log)"
12
Production maintenance

Re-check network membership and port bindings after reboots and container upgrades

A recreated container can be healthy but unable to talk to the rest of the AI stack if its --network setting is missing. After upgrades, verify Docker-network membership instead of checking only container status.

Also verify that host ports were not accidentally republished on 0.0.0.0. Combining a private Docker network with localhost-only host bindings preserves service communication while reducing unnecessary public exposure.

Command 1
docker network inspect eka-ai
Command 2
docker ps --format 'table {{.Names}}\t{{.Ports}}'
Command 3
ss -lntp | grep -E ':11434|:3000|:5678'
Production checklist

Docker network and port security checklist

Group related services on a project-specific user-defined bridge.
Use Docker DNS and container names instead of hard-coded container IPs.
Do not publish Ollama port 11434 directly on public 0.0.0.0.
Keep n8n 5678 and Open WebUI 3000 on localhost behind a reverse proxy.
Re-check network membership after container updates.
Inspect private networks for unexpected attached containers.
Publish public services through a TLS reverse proxy.
Test DNS and real HTTP connectivity separately during troubleshooting.
R
Official sources

Official Docker networking resources

+
EKA Sunucu

Related EKA Sunucu Docker, Ollama, Open WebUI and n8n guides

?
FAQ

Frequently asked questions about Docker networks, localhost and container DNS

What does localhost mean inside a Docker container?

It refers to that container's own network namespace, not another container.

Which URL should n8n use for Ollama?

On the same user-defined network, use http://ollama:11434 when the container name is ollama.

Which URL should the host use for Ollama?

Our real host-side deployment used http://127.0.0.1:11434.

Why use a user-defined bridge?

It provides name-based communication and better project isolation between attached containers.

How do I create eka-ai?

Run docker network create eka-ai.

Can I attach a running container later?

Yes. Use docker network connect eka-ai CONTAINER.

Should I hard-code container IPs?

Usually no. Use container names through Docker DNS because container IPs can change.

How does Docker DNS work here?

Containers on custom user-defined networks can resolve one another by container name.

What should I check when n8n and Ollama share a host but cannot connect?

Verify network membership, hostname resolution and the real HTTP endpoint in that order.

Which Ollama Base URL did Open WebUI use?

Our working deployment used OLLAMA_BASE_URL=http://ollama:11434.

Does Ollama port 11434 need to be public?

No. Containers on the same Docker network can reach it without a public host port.

How were ports 5678 and 3000 protected?

They were bound only to 127.0.0.1 and public access was provided through Nginx HTTPS.

What does docker network inspect show?

Network driver, subnet, gateway and attached-container information.

What should I verify after container upgrades?

Re-check network membership, Docker DNS, a real HTTP request and host port bindings.

EKA YAZILIM VE BİLİŞİM SİSTEMLERİ

Need a Linux VPS for Docker-based AI services?

Run n8n, Ollama, Open WebUI and other self-hosted services with private Docker networking on EKA Sunucu Linux VPS.

Updated: 10.08.2026
View Linux VPS PlansLinux & VPS Guides
Top