open-webui / docs

https://docs.openwebui.com
https://docs.openwebui.com
50 stars 64 forks source link

Variable PORT is not included in the documentation #48

Closed tristangrimaux closed 1 month ago

tristangrimaux commented 2 months ago

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
justinh-rahb commented 2 months ago

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.

tristangrimaux commented 2 months ago

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.

justinh-rahb commented 1 month ago

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