Skip to content

Commit cfe4847

Browse files
committed
Fix issue preventing ollama service from being exposed on Internet
Move ollama and webui containers to a public bridge network, expose port 7861 to allow Internet connections to the service, and set host name to container name for communication. Adding the containers to a bridge network is best practice. The port 11434 does not need to be exposed to the Internet. Finally, the port 7861 does need to be exposed. In addition, the host firewall will need to have IP Masquerading turned on to allow the ollama container to connect to the model registry, and the host's ethernet device needs to be added to the "devices" field for the public firewalld zone. I will propose a separate change in the README for these steps.
1 parent 8a360d0 commit cfe4847

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

compose.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ services:
5454
container_name: ollama_demo_service
5555
volumes:
5656
- ollama:/root/.ollama
57-
#network_mode: host
58-
ports:
59-
- "11434:11434"
57+
networks:
58+
- public
6059
environment:
6160
- "OLLAMA_HOST=0.0.0.0:11434"
6261
tty: true
@@ -69,14 +68,15 @@ services:
6968
- open-webui:/app/backend/data
7069
depends_on:
7170
- ollama_demo_service
72-
network_mode: host
73-
#ports:
74-
# - "7863:7863"
71+
networks:
72+
- public
73+
ports:
74+
- "7861:7861"
7575
environment:
7676
- 'PORT=7861'
7777
- 'ENV=dev'
7878
- 'VECTOR_DB=chroma'
79-
- 'OLLAMA_BASE_URL=http://0.0.0.0:11434'
79+
- 'OLLAMA_BASE_URL=http://ollama_demo_service:11434'
8080
- 'WEBUI_NAME=Ampere Llama Chat'
8181
- 'ENABLE_LITELLM=False'
8282
- 'WEBUI_SECRET_KEY='
@@ -86,3 +86,7 @@ services:
8686
volumes:
8787
ollama: {}
8888
open-webui: {}
89+
90+
networks:
91+
public:
92+
driver: bridge

0 commit comments

Comments
 (0)