unraid / webgui

Unraid Web UI
146 stars 71 forks source link

[Docker][Advanced] Support parsing Docker run / Docker compose's service syntax for creating templates #1816

Open andrebrait opened 1 month ago

andrebrait commented 1 month ago

Essentially, I'd like to be able to create (or even maintain/edit, maybe?) container templates using either the docker run command and/or the docker compose service syntax. That would to more easily create templates and edit them by hand rather than dealing with the UI.

Originally posted by @luzfcb in https://github.com/unraid/webgui/issues/1813#issuecomment-2272397605

I don't know if it's the same thing as you thought, but I like OpenWRT's luci-app-dockerman option:

It has an option called Resolve CLI You click on it, paste the docker create or docker run command, and then submit it to the backend, the backend parses the command, and the page/form reloads with all fields filled

step1:

image

step2:

image

step3

All fields was filled and you are able to customize mode before creating the container

image

The most logic is implemented in Lua https://github.com/lisaac/luci-app-dockerman/blob/7292955a1b415bb60fa2e403bb3a437b4b7f7846/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua#L63C1-L363C4

thezoggy commented 6 days ago

just in case you were not aware, you can already do this by installing the docker-compose plugin and then just doing your compose yaml https://docs.ibracorp.io/docker-compose/docker-compose-for-unraid

andrebrait commented 6 days ago

just in case you were not aware, you can already do this by installing the docker-compose plugin and then just doing your compose yaml https://docs.ibracorp.io/docker-compose/docker-compose-for-unraid

I'm aware of it, but it's not the same as first party support and there are good things about unRAID Templates and I think the user experience could be improved by either supporting or being able to convert from and to such syntax.

I think integrating it directly into the WebUI could have a lot of benefits for both users as well as container template authors.

Example: more advanced features or more easily making changes, etc., less need of modifying the UI to support new changes to Docker (for example, the current version on 6.12 already supports multiple networks and whatnot, but the UI does not).

By supporting the syntax/contract/schema of Docker Compose directly, it should be possible to derive the GUI from it and need less manual changes in the long run.

Eventually, we could even have templates that encompass an entire software stack (think a nice way to present a Docker Compose file in the App center).

That's not doable as of now via any plugins, and won't be without some significant amount of work.

Of course, baby steps. The proposal here is to just support converting like it does with showing you the command for docker create