Skip to content

fix: don't delete the shared default docker icon when removing an icon-less container#2693

Open
chodeus wants to merge 1 commit into
unraid:masterfrom
chodeus:fix/preserve-default-docker-icon
Open

fix: don't delete the shared default docker icon when removing an icon-less container#2693
chodeus wants to merge 1 commit into
unraid:masterfrom
chodeus:fix/preserve-default-docker-icon

Conversation

@chodeus

@chodeus chodeus commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Fixes #2691 — the docker manager deletes its own shared fallback icon (question.png) whenever an icon-less container is removed or updated with cache flags, and once the file is missing, every icon-less container's onerror fallback re-requests it in a tight loop until the next reboot.

Changes

  • include/DockerClient.php (removeContainer()) — skip the icon unlink when the recorded icon is the shared default. Containers with no template icon get /plugins/dynamix.docker.manager/images/question.png recorded as their icon (L346), so the existing unlink deleted the shared static file from the docroot for the whole system. Per-container cached icons (<name>-icon.png) are still cleaned up exactly as before.
  • include/DockerContainers.php — quote the onerror attribute and guard it with this.onerror=null, so a missing fallback costs one failed request per image instead of an endless 404 retry loop (measured ~150 req/s against nginx with 15 affected images on one open Docker page).

Testing (real hardware, per the README workflow)

Tested on Unraid 7.3.2 — both files are byte-identical between 7.3.2 and master at 369f0b2, so the patched master files were copied to the live server directly.

  • php -l clean on both files.
  • Functional test of removeContainer() via injected webui-info registry entries:
    • entry recording the shared default icon, removed with cache=2question.png survives, registry entry cleaned up ✓
    • entry recording a per-container /state/...-icon.png (file created for the test), removed with cache=1 → cached icon still unlinked, registry entry cleaned up ✓ (registry returned to its original entry count)
  • Browser test with question.png temporarily removed: stock-rendered container images now fail once and stop — previously an endless 404 retry loop. The Docker page renders normally in both states. (The only remaining repeat-requester on my test box traced to a third-party plugin carrying its own copy of the unguarded onerror pattern.)
  • The original deletion was observed in the wild via CA Docker Auto-Update updating an icon-less container — full trace in Docker manager deletes its shared fallback icon (question.png) when an icon-less container is removed/updated #2691.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented cleanup from accidentally removing the shared default container icon.
    • Improved fallback handling when a container icon image fails to load, avoiding repeated error handling.

…n-less container

Containers with no template icon get /plugins/dynamix.docker.manager/images/question.png
recorded as their icon in the webui-info registry (DockerClient.php L346). removeContainer()
then unlinks that recorded path when cache flags are set, deleting the shared fallback from
the docroot for the whole system until the next reboot. CA Docker Auto-Update triggers this
whenever it updates an icon-less container.

Also quote and guard the container-list onerror fallback (this.onerror=null) so a missing
fallback degrades to one failed request per image instead of an endless 404 retry loop.

Fixes unraid#2691
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ac8e7533-d9ad-4d5d-8167-8cae99b4d462

📥 Commits

Reviewing files that changed from the base of the PR and between 369f0b2 and 6f28eb6.

📒 Files selected for processing (2)
  • emhttp/plugins/dynamix.docker.manager/include/DockerClient.php
  • emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php

Walkthrough

Docker container cleanup now preserves the shared question icon, and PNG fallback rendering disables repeated onerror handling before replacing failed images.

Changes

Docker icon safeguards

Layer / File(s) Summary
Protect shared fallback icon
emhttp/plugins/dynamix.docker.manager/include/DockerClient.php, emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php
Container removal no longer unlinks the shared question icon, and PNG image fallbacks clear their error handler before retrying.

Estimated code review effort: 2 (Simple) | ~5 minutes

Suggested reviewers: elibosley

Poem

A bunny checks the icons bright,
Keeps question.png safe through the night.
If PNGs fail, the loop is done,
One fallback hop, then back to fun.
Hop, hop—no errors spun!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: preserving the shared fallback Docker icon for icon-less containers.
Linked Issues check ✅ Passed The code prevents unlinking the shared question.png and guards the image onerror loop, matching issue #2691's requirements.
Out of Scope Changes check ✅ Passed The PR only changes the icon deletion and fallback handling needed for the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Docker manager deletes its shared fallback icon (question.png) when an icon-less container is removed/updated

1 participant