Skip to content

feat(docker): attach containers to multiple custom networks (OS-503) - #2687

Merged
tom mortensen (limetech) merged 2 commits into
masterfrom
feat/docker-multi-network
Jul 21, 2026
Merged

tom mortensen (limetech) merged 2 commits into
masterfrom
feat/docker-multi-network

Conversation

@elibosley

@elibosley Eli Bosley (elibosley) commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Problem

DockerMan templates can only express a single <Network>. A container that needs two custom networks (e.g. a reverse-proxy network and a service network) has to be docker network connected by hand, and that extra attachment is lost on any UI recreate/update — the container silently drops back to one network. This bites reverse-proxy sidecars, management tools, and anything bridging two isolated stacks.

Approach

docker create/run only accepts one --network, so extra networks are attached with docker network connect after the container is created. A new optional <ExtraNetworks> template field (comma/space separated) drives it.

  • Helpers.php
    • postToXML persists <ExtraNetworks> from the form
    • xmlToVar parses it
    • new connectExtraNetworks() — idempotent, skips the primary network, runs on created and running containers
  • CreateDocker.php
    • create path: connects extras from the form POST after execCommand
    • update/recreate path: connects extras from the template (getXmlVal) after execCommand
    • editor UI: an "Additional Networks" multi-select of available custom networks

Backward compatible: absent/empty field = today's single-network behaviour.

Testing (against live Docker on 7.x)

  • connectExtraNetworks moved a real container vanilla-net → appnet vanilla-net; second call idempotent + correctly skipped the primary.
  • xmlToVar path-parse → ExtraNetworks=[appnet, proxynet]; postToXML↔xmlToVar round-trips; update-path getXmlVal reads it.
  • End-to-end payoff: a multi-homed container became reachable by name from a reverse proxy on the shared network (no host-IP workaround).
  • php -l clean on both files.

Follow-ups / review notes

  • Editor UI wants a manual browser click-through (create → pick two networks → apply).
  • Managed/orphan + "update ready" detection keys on image/template, not full network set, so multi-homing shouldn't cause false "not up to date" — worth a reviewer sanity check.

Targeting 7.4.0.

Linear

  • OS-503

DockerMan templates could only express one <Network>, so a container that
needed two custom networks (e.g. a reverse-proxy net + a service net) lost
the extra ones on any UI recreate/update. Docker create/run only accepts a
single --network, so this adds an <ExtraNetworks> template field (comma
separated) that is applied with 'docker network connect' after the container
is created, on both the create and update/recreate paths.

- postToXML/xmlToVar: persist + parse <ExtraNetworks>
- connectExtraNetworks(): idempotent, skips the primary network
- AddContainer UI: 'Additional Networks' multi-select of custom networks
- backward compatible: empty/absent field = single-network behaviour
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3afa00b7-95ef-4a54-8787-c87a2e89b5a4

📥 Commits

Reviewing files that changed from the base of the PR and between 369f0b2 and 438aa4f.

📒 Files selected for processing (2)
  • emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php
  • emhttp/plugins/dynamix.docker.manager/include/Helpers.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/docker-multi-network

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.07.08.2354
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2687/webgui-pr-2687.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php
emhttp/plugins/dynamix.docker.manager/include/Helpers.php

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2687, or run:

plugin remove webgui-pr-2687

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@elibosley Eli Bosley (elibosley) changed the title feat(docker): attach containers to multiple custom networks feat(docker): attach containers to multiple custom networks (OS-503) Jul 8, 2026
@unraid-bot Unraid Bot (unraid-bot) added the 7.4.0 Approved for release 7.4.0 (auto-managed by notification-worker) label Jul 9, 2026
@limetech
tom mortensen (limetech) merged commit 7a581da into master Jul 21, 2026
5 checks passed
@limetech
tom mortensen (limetech) deleted the feat/docker-multi-network branch July 21, 2026 20:21
@unraid-bot Unraid Bot (unraid-bot) removed the 7.4.0 Approved for release 7.4.0 (auto-managed by notification-worker) label Jul 21, 2026
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

Successfully merging this pull request may close these issues.

3 participants