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

[Docker] Add the ability to select multiple custom networks for containers #1812

Open
andrebrait opened this issue Aug 2, 2024 · 14 comments

Comments

@andrebrait
Copy link

Disclaimer: this is more of an RFC as I intend to implement this myself and submit a PR.

The problem

Since version 25.0, docker run takes multiple --network arguments, meaning we can now connect containers to multiple (custom) networks. Unraid, however and from what I can see on the master branch here, allows only for a single network to be selected.

The proposal

Turn the network selection field into a checkbox list. Some restrictions must apply, to reflect limitations of the docker run command, such as not being possible to select both bridge/host networks at the same time as custom ones.

Complications

The syntax to expose ports must address the fact ports can now be exposed for different networks.

@mtongnz
Copy link
Contributor

mtongnz commented Aug 15, 2024

I had a similar thought to this and have been toying with it over the last month:
https://github.com/mtongnz/unRaid-webgui/tree/docker-multiple-networks

So that this worked on the current version of unRaid, I took the approach of using network connect to get around the older version of docker not allowing multiple networks via the run command. I changed docker run to docker create, then multiple network attach (if needed), then docker start. This ensures networks are attached prior to the container starting. This approach is pretty easy to change in the future when docker is updated.
I also used a format that would accept the current templates with a single network so it wouldn't impact the container templates currently in use.

Would be interested in your thoughts.

@andrebrait
Copy link
Author

@mtongnz it looks exactly like what I'd like. I can't patch cleanly on top of my installation because it's missing some folders, though (e.g. emhttp/plugins/dynamix.docker.manager/sheets') and I'm not sure what to do there

@mtongnz
Copy link
Contributor

mtongnz commented Aug 16, 2024

What unRAID version are you on?

@andrebrait
Copy link
Author

@mtongnz 6.12.11

@mtongnz
Copy link
Contributor

mtongnz commented Aug 16, 2024

It should work then. I only modified the existing files. I didn't add/delete anything

@andrebrait
Copy link
Author

@mtongnz hm, weird. The entire folder is missing for me. I assume there isn't a build script that processes it somehow?

@andrebrait
Copy link
Author

@mtongnz mystery solved: the folder does not exist in the 6.12 branch (in all tags that it includes), only on master and tags 6.13.0-beta1 and later.

@mtongnz
Copy link
Contributor

mtongnz commented Aug 16, 2024

Screenshot_20240816_191444_GitHub.jpg

It's showing in my repo on GitHub on my phone... Not sure why it's not showing for you

@andrebrait
Copy link
Author

andrebrait commented Aug 16, 2024

@mtongnz it's showing on my phone too. The folder does not exist on my server because it's running 6.12.11.

The folder only exists in 6.13 (a.k.a. 7) and later, and master, of course.

@mtongnz
Copy link
Contributor

mtongnz commented Aug 16, 2024

Ah... That makes sense.
I'd forked the master branch on GitHub

@andrebrait
Copy link
Author

No problem. An improvement like this probably won't make it to 6.12 anyway, so I'll update to the next beta of 7 and go from there.

@mtongnz
Copy link
Contributor

mtongnz commented Aug 16, 2024

I'm running 6.12 but with the latest webui version. I'll wait to update unRAID until it's stable as my server is critical. It seems to run fine. If there's issues, a server reboot reverts the UI to the installed version.

@andrebrait
Copy link
Author

You mean you downloaded it from here and uploaded it to your server?

@mtongnz
Copy link
Contributor

mtongnz commented Aug 17, 2024

You mean you downloaded it from here and uploaded it to your server?

I use VSCode with git for versioning, and STFP to sync the files to my unRaid. So in VSCode, I can have multiple branches of code that I switch between and then sync them to unRaid to test. SFTP can also be set to auto-push any changes as you save them.
https://docs.pantheon.io/guides/sftp/vscode-sftp

On unRaid, create an SSH key and save it to somewhere accessible from VSCode. Here's the folder structure for the unRaid/webgui project:
image

Here's my sftp.json:
{ "name": "unRaid", "host": "192.168.1.123", "protocol": "sftp", "port": 22, "username": "root", "privateKeyPath": ".vscode/ssh.key", "remotePath": "/usr/local", "uploadOnSave": true, "useTempFile": false, "openSsh": true, "ignore": [ "// comment: ignore dot files/dirs in root of repo", ".vscode", ".git", ".DS_Store", "// comment: ignore symlinks in repo", "sbin/emcmd", "sbin/plugin", "sbin/language", "sbin/newperms", "sbin/inet", "sbin/samba", "sbin/diagnostics", "emhttp/boot", "emhttp/state", "emhttp/mnt", "emhttp/log", "emhttp/plugins/dynamix/images/case-model.png", "emhttp/webGui", "// comment: ignore files distributed by Unraid Connect", "emhttp/plugins/dynamix.my.servers", "emhttp/plugins/dynamix/include/UpdateDNS.php" ] }
All you should need to update in the config is the IP.

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

2 participants