Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable PORT is not included in the documentation #48

Closed
tristangrimaux opened this issue Apr 22, 2024 · 3 comments
Closed

Variable PORT is not included in the documentation #48

tristangrimaux opened this issue Apr 22, 2024 · 3 comments

Comments

@tristangrimaux
Copy link

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
Copy link
Contributor

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.

@tjbck tjbck transferred this issue from open-webui/open-webui Apr 22, 2024
@tristangrimaux
Copy link
Author

tristangrimaux commented Apr 26, 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.

@justinh-rahb
Copy link
Contributor

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

@tjbck tjbck closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants