dockcheck icon indicating copy to clipboard operation
dockcheck copied to clipboard

Unable to update containers in Synology DSM running Container Manager

Open sysdad opened this issue 1 year ago • 9 comments

Running dockcheck on a Synology DS1522+ to evaluate docker containers running in container manager. Dockcheck works as intended, successfully identifying updates and sending email notifications using the DSM template. However, it is unable to execute updates for containers running in Container Manager.

When attempting to execute an update, I'm met with the following error: Error response from daemon: Conflict. The container name "/container-name" is already in use by container "long-string". You have to remove (or rename) that container to be able to reuse that name.

This error persists regardless of if the update is triggered via -a or -y tag, or specific container selected via prompt. All Container Manager containers in question are built using docker compose files within in the Container Manager GUI.

Additionally, dockcheck identifies image updates that are not visible for updating in the Container Manager GUI. Unlikely this is due to image changes without new tags, as it's confirmed to affect images that have seen new releases tagged in github.

Referencing a comment made in an earlier issue, suggesting dockcheck will not work when using the Container Manager GUI.

On synology I use the GUI to run & update individual images which gives you a wizard to edit/store all the parameters for each container. You can also create projects (docker compose behind the scenes) in the GUI. You can also use docker compose entirely manually (no GUI).

From this reddit discussion with that same error (conflict between GUI and manual mode), it sounds like to use the command line (like dockcheck.sh) to manage updates he should probably exclusively go the docker compose manual (no GUI) route.

Note my other non-DSM docker systems use docker compose and dockcheck.sh normally.

Originally posted by @yoyoma2 in #161

sysdad avatar Apr 13 '25 04:04 sysdad

Thank you for creating a new issue for further discussion.

Dockcheck works as intended, successfully identifying updates and sending email notifications using the DSM template. However, it is unable to execute updates for containers running in Container Manager.

I don't have any synology products myself so can't test - but I would assume the Container Manager is somewhat similar to Portainer in that it creates its own directory structure and handle things a bit different with mounts and compose.

You could check some of this by running the extras/errorCheck.sh script, it's lacking some but will show some paths.

Additionally, dockcheck identifies image updates that are not visible for updating in the Container Manager GUI.

That's probably because (as you mentioned) due to Dockcheck using registry hashes to determine updates while CM maybe uses tags/releases only. Dockcheck will see any change as an update, everything from a typo to a full rebuild.

As @yoyoma2 suggested - if you'd like to use Dockcheck for doing the updates, you should probably set things up using plain docker compose in the CLI.

I don't know if there's anything I can do or change to support the Synology setup better.

mag37 avatar Apr 13 '25 08:04 mag37

Additionally, dockcheck identifies image updates that are not visible for updating in the Container Manager GUI.

On synology DSM I use dockcheck only for the notifications and manage the docker updates with the Container Manager GUI. I had noticed that the newly available images were not always seen by Container Manager so the following lines were added to the DSM notify template. Make sure your DSM notify template is up to date.

# This ensures DSM's container manager will also see the update
/var/packages/ContainerManager/target/tool/image_upgradable_checker

Since these lines were added, whenever I get a notification from dockcheck, I also see them from the CM GUI. You could create a scheduled task that runs that command as root on the schedule you prefer. I don't know how often DSM runs this check itself but it doesn't seem to be very frequent.

yoyoma2 avatar Apr 13 '25 12:04 yoyoma2

@firmlyundecided is there anything else I can do for you in this regard or have you resolved your issues?

mag37 avatar Apr 23 '25 05:04 mag37

Perhaps dockcheck could detect DSM and refuse to update containers or at least warn to avoid using the DSM GUI.

$ cat /etc/VERSION | grep os_name
os_name="DSM"
$ 

I have zero user_managed_compose_project since I don't use projects (DSM's term for docker compose).

$ sudo /volume1/@appstore/ContainerManager/tool/synouserdata_docker | jq .project
{
  "total_compose_project": 0,
  "user_managed_compose_project": 0,
  "web_managed_compose_project": 0,
  "web_service_registered": 0
}
$

Perhaps the dockcheck update would work on containers run without a project like mine but I never dared to try.

yoyoma2 avatar Apr 23 '25 11:04 yoyoma2

I'm not sure what the best solution is. @yoyoma2's suggestion is interesting. perhaps it's even a call-out in the docs, to be a little more light-handed.

The actual ideal solution would be to figure out how to force Container Manager to play nice, but 1/ that's above my pay grade, and 2/ my experiences tell me that Container Manager and DSM simply isn't the nicest Docker environment to play in.

sysdad avatar Apr 23 '25 14:04 sysdad

@yoyoma2

Perhaps dockcheck could detect DSM and refuse to update containers or at least warn to avoid using the DSM GUI.

$ cat /etc/VERSION | grep os_name
os_name="DSM"
$ 

While this is sensible - I'm a bit hesitant to start adding specific checks and warnings for different environments - I mean there's a bunch of different Hypervisors/VMs/LXCs/OSes/Environments that all can be modified by the user. The user have to be responsible to know some of how their containers are managed.

@firmlyundecided

I'm not sure what the best solution is. @yoyoma2's suggestion is interesting. perhaps it's even a call-out in the docs, to be a little more light-handed.

See above - but yes, mentioning it in the docs sounds reasonable. A heads-up section.

The actual ideal solution would be to figure out how to force Container Manager to play nice, but 1/ that's above my pay grade, and 2/ my experiences tell me that Container Manager and DSM simply isn't the nicest Docker environment to play in.

As I don't have a DSM myself (someone gift me one please! 😁 ) I cant really dive in to that even if I'd have time. But yes I'm afraid it probably uses some custom layering / embedded subvolumes or similar.

mag37 avatar Apr 23 '25 18:04 mag37

Agreed re: documentation call-out, that users leveraging DSM's container manager may have issues automatically updating containers via the tool.

To help your documentation, here's the quick setup for automating Dockcheck via DSM's Task Scheduler:

  1. Open Control Panel and navigate to Task Scheduler
  2. Create a Scheduled Task > User-defined script
  3. Task Name: Dockcheck
  4. User: root
  5. Schedule: User Preference
  6. Task Settings:
  7. ✔ Send run details by email (include preferred email)
  8. User-defined script: export HOME=/root && cd /path/to/dockcheck && ./dockcheck.sh -n -i -I or other custom args
  9. Click OK, accept warning message

Note: This setup will result in two emails sent, one by dockcheck (due to the -I flag) and one by DSM. The dockcheck email only includes the notification of available updates, while the DSM email shows the entire script as run. This is a user preference, and both are not necessary. Since Dockcheck cannot directly update containers in Container Manager, at least one email notification option should be enabled to use Dockcheck so you can be aware of manual updates available.

Image Image Image

sysdad avatar Apr 23 '25 19:04 sysdad

A heads-up section.

I like that! Also nice documentation @firmlyundecided !

yoyoma2 avatar Apr 23 '25 20:04 yoyoma2

Thank you @firmlyundecided for the provided screenshots and writeup! I'll surely implement it somehow. Considering how I should structure it, if I should add it into addons like addon/DSM-info/... so it'll be a proper readme in that directory.

I'll convert this issue to a discussion!

mag37 avatar Apr 25 '25 17:04 mag37