Variable PORT is not included in the documentation #20

Closed
opened 2026-02-15 17:05:12 -05:00 by yindo · 3 comments
Owner

Originally created by @tristangrimaux on GitHub (Apr 22, 2024).

The documentation correctly states the use of the option "--net host" when having problems to connect but fails to provide the environment variable PORT to configure the web port because when running the docker container in the same network as the host, the options to publish a port are ignored.

Also, the documentation on the environment variables fails to provide the existence of the variable PORT that I could find in the source code.

A better example line could be this

docker run -d -p 9090:8080 --net host -e PORT=9090 -e OLLAMA_BASE_URL=http://10.10.20.1:11434 -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

or a docker compose version like this:

services:
    open-webui:
        ports:
            - 9090:8080
        network_mode: host
        environment:
            - PORT=9090
            - OLLAMA_BASE_URL=http://10.10.20.1:11434
        volumes:
            - open-webui:/app/backend/data
        container_name: open-webui
        restart: always
        image: ghcr.io/open-webui/open-webui:main
volumes:
    open-webui:
        external: true
        name: open-webui

Originally created by @tristangrimaux on GitHub (Apr 22, 2024). The documentation correctly states the use of the option "--net host" when having problems to connect but fails to provide the environment variable PORT to configure the web port because when running the docker container in the same network as the host, the options to publish a port are ignored. Also, the documentation on the environment variables fails to provide the existence of the variable PORT that I could find in the source code. A better example line could be this `docker run -d -p 9090:8080 --net host -e PORT=9090 -e OLLAMA_BASE_URL=http://10.10.20.1:11434 -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main ` or a docker compose version like this: ``` services: open-webui: ports: - 9090:8080 network_mode: host environment: - PORT=9090 - OLLAMA_BASE_URL=http://10.10.20.1:11434 volumes: - open-webui:/app/backend/data container_name: open-webui restart: always image: ghcr.io/open-webui/open-webui:main volumes: open-webui: external: true name: open-webui ```
yindo closed this issue 2026-02-15 17:05:12 -05:00
Author
Owner

@justinh-rahb commented on GitHub (Apr 22, 2024):

I will make a note to add the PORT variable explanation for host networking scenarios. However I'd be remiss if I did not point out:

The "-p" flag in Docker maps container ports to the host. But if you use "--net=host," which sets the container's network mode to match the host, this override makes the "-p" flags redundant. The container then runs in the host's network, making all ports accessible without additional mapping.

@justinh-rahb commented on GitHub (Apr 22, 2024): I will make a note to add the `PORT` variable explanation for host networking scenarios. However I'd be remiss if I did not point out: > The "-p" flag in Docker maps container ports to the host. But if you use "--net=host," which sets the container's network mode to match the host, this override makes the "-p" flags redundant. The container then runs in the host's network, making all ports accessible without additional mapping.
Author
Owner

@tristangrimaux commented on GitHub (Apr 25, 2024):

Thanks! You are correct, another mistake of the documentation that states correctly that the use of "--net=host" sets the container's network to match the host, but states that the -p flag is redundant which is not, it's completely ignored. The documentation should note that the container runs in the host's network, making all ports mapped directly on the host.

That's precisely why it should be noted that, for the container could run in the server, webui would need to be configured to run on a port that is not conflicting with the server ports in use and that's where this variable is so important.

@tristangrimaux commented on GitHub (Apr 25, 2024): Thanks! You are correct, another mistake of the documentation that states correctly that the use of "--net=host" sets the container's network to match the host, but states that the -p flag is redundant which is not, it's completely ignored. The documentation should note that the container runs in the host's network, making all ports mapped directly on the host. That's precisely why it should be noted that, for the container could run in the server, webui would need to be configured to run on a port that is not conflicting with the server ports in use and that's where this variable is so important.
Author
Owner

@justinh-rahb commented on GitHub (Jun 4, 2024):

This has already been added to docs, let's close it @tjbck

@justinh-rahb commented on GitHub (Jun 4, 2024): This has already been added to docs, let's close it @tjbck
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/docs#20