EtiennePerot / open-webui-code-execution

Code execution utilities for Open WebUI & Ollama
Apache License 2.0
117 stars 6 forks source link

Support docker compose for "the hard way" #19

Open jmtatsch opened 1 day ago

jmtatsch commented 1 day ago

Is your feature request related to a problem? Please describe. As a forgetful prosumer I always forget the docker calls to launch my services but don't have my own kubernetes cluster ;) I simply define my services in docker-compose files which works well enough for me.

Describe the solution you'd like I would like to amend the tutorial with the commands for docker compose or add a sample docker-compose.yml to bring up a working open-webui instance prepared for code execution.

Own work I looked up how to transform all these docker flags into docker compose and this is what i came up with:

open-webui:
    build:
      context: .
      args:
        OLLAMA_API_BASE_URL: '/ollama/api'
      dockerfile: Dockerfile
    image: ghcr.io/open-webui/open-webui:main
    security_opt:
      - seccomp:unconfined
      - apparmor=unconfined
      - label=type:container_engine_t
    container_name: open-webui
    volumes:
      - open-webui:/app/backend/data
      - /sys/fs/cgroup:/sys/fs/cgroup:rw
      - /proc:/proc2:rw

The only flag that I didn't manage to set in docker compose is bind-recursive=disabled for procfs Is that absolutely necessary? Seems like that isn't possible yet in docker-compose yet https://github.com/docker/compose/issues/11792

Once the serivce is up, I ask it to curl a site and it errors out like this: Environment needs setup work: /sys/fs/cgroup/cgroup.subtree_control not found; make sure you are using cgroups v2

but I guess that might be issue https://github.com/EtiennePerot/open-webui-code-execution/issues/14 .

EtiennePerot commented 1 day ago

bind-recursive=disabled for procfs Is that absolutely necessary?

It is necessary if your host machine's /proc mount has submounts, which on many Linux distributions it does (e.g. /proc/sys/fs/binfmt_misc). Otherwise, Docker will try to mount /proc along with all its submounts to /proc2, and thus the container still doesn't get an unobstructed view of procfs. So yes, it is usually necessary. :(

However privileged=true should work for Docker Compose, so perhaps the setup guide can contain Docker Compose instructions for the "easy way", but explain why the hard way doesn't have such instructions.

Once the serivce is up, I ask it to curl a site and it errors out like this: Environment needs setup work: /sys/fs/cgroup/cgroup.subtree_control not found; make sure you are using cgroups v2 but I guess that might be issue #14

Indeed.