Start docker if corresponding WebUI URL is requested


Recommended Posts

Right now, if a docker is stopped, then (obviously) if you try to pull up the URL of the webUI, it will time out. But I'm proposing that instead, the corresponding Docker should be started, and then the URL will open to the webUI. This will be very useful if you have a bunch of small Dockers that you may not use often, but don't want to leave running all the time (thinks like download managers, bittorrent clients, video transcoders, etc). So, assuming that the user bookmarks the URLs for the dockers, they can be auto-started, instead of having to log into Unraid and starting the Docker manually.

 

I'm hoping that this could be implemented with only minor modifications to the current way that the WebUI requests are processed

Edited by BestITGuys
Link to comment
44 minutes ago, BestITGuys said:

user bookmarks the URLs for the dockers

If it's bookmarked in the browser, then the browser will try and connect and then fail and no real way for the system to basically catch that without a major overhaul on how things work (basically open up all the ports, see if a request comes in on such and such port, see if it matches a webURL and then start the container, wait a bit, then redirect to the URL in question)

 

On the other hand, I can see that the webUI entry in the docker tab being able to start up the container if it's not running, but it might not be worth the programming because since you're there on the docker / dashboard tab anyways, its really not much to start the container and then click the webURL.

 

Nice idea though.

Link to comment

That makes sense, and at least having the docker auto start if the "open webUI" option is selected would be nice.

 

But I'm also not ready to give up on the idea of just listening for a URL request and starting the docker from that. Maybe I'm not understanding how the URL requests are processed, but I thought that there is some kind of a web server (prolly nginx) always listening for URL requests. And all the dockers have their port bindings mapped, so if a docker is running, and it has a webUI, the web server forwards that request to the docker on that port.  If the above is correct, then couldn't the webserver check if that docker is running, and if not, start it?

Link to comment
3 minutes ago, BestITGuys said:

And all the dockers have their port bindings mapped, so if a docker is running, and it has a webUI, the web server forwards that request to the docker on that port.  If the above is correct, then couldn't the webserver check if that docker is running, and if not, start it?

That is not how things work.     In such cases the web server For the container GUI is running inside the docker container and so requests do not go anywhere near the web server supporting the Unraid GUI.

Link to comment

So, I've had a couple of days to think about this, and I think I came up with a relatively easy way to implement this (or at least I hope so). Couldn't you just add an extra parameter that could be passed to the URL that tells it to start the container and launch the webUI (if one is defined)?

 

So, if the current URL to edit a Docker config is something like this (using qBittorrent as an example):

http://192.168.1.100/Docker/UpdateContainer?xmlTemplate=edit:/boot/config/plugins/dockerMan/templates-user/my-binhex-qbittorrentvpn.xml

 

The new one could be something like this:

http://192.168.1.100/Docker/UpdateContainer?startUI=true&xmlTemplate=/boot/config/plugins/dockerMan/templates-user/my-binhex-qbittorrentvpn.xml

 

And all that really has to change on the back end is that the script that processes the URLs just needs to parse for that one extra parameter, and if it's present, it'll start the container and launch the webUI instead of opening the Docker edit config page.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.