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

[BUG]: Updating Docker images (that uses a base image) seemingly doesn't update variables, when the base image does #246

Open
engels74 opened this issue Apr 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@engels74
Copy link

engels74 commented Apr 23, 2024

What happened?

So there's this issue I had, specifically with the Docker images that hotio supplies.

He recently updated his base image, with a change to a Docker ENV/VAR, named S6_STAGE2_HOOK. It was changed from /init-hook to /etc/s6-overlay/init-hook.

When the images were updated in Cosmos-server, they didn't change the existing images environment variables to reflect this. They were left as /init-hook, which broke most of his images.

What should have happened?

The variable S6_STAGE2_HOOK should've been updated on the existing containers.

How to reproduce the bug?

  1. Download any hotio release older than this commit
  2. E.g. this radarr release here
  3. Run the container
  4. Check if the S6_STAGE2_HOOK has the value of /init-hook
  5. Update the container / Pull New Image
  6. Check Cosmos, and see that S6_STAGE2_HOOK is still set to /init-hook
  7. Check radarr logs, and see that everything has gone haywire (vpn/privoxy errors from the hook not working properly)
  8. Remove the var S6_STAGE2_HOOK manually through Cosmos
  9. Recreate the container
  10. The now-correct (updated) S6_STAGE2_HOOK will show up with /etc/s6-overlay/init-hook

Relevant log output

No response

Other details

The easy solution was to manually go into every Docker container through Cosmos, remove the S6_STAGE2_HOOK variable, press "Update Container" and let Cosmos recreate it, with the now-correct S6_STAGE2_HOOK variable.

I'm thinking this would be great if Cosmos would take this into account, when updating images. That being, when "base" images are updated, and if that somehow affects or changes existing containers variables. So that the user can use the auto update, and be sure knowing that Cosmos will update existing variables ;).

A simple GIF of how it was "solved" in Cosmos:
https://i.imgur.com/hTJKwks.gif

I'm sure other users will end up having this problem, atleast if they use hotio's containers. I made a neat little simple bash script to detect what containers has the S6_STAGE2_HOOK variable set to /init-hook:
https://logs.notifiarr.com/?37e0ff883c53d517=#8WuwvRSycAV4MzcMJJsDLDYtEtT48CmUbryiU6C8geUz

System details

  • OS: Ubuntu 22.04.4 LTS (running in VM on UnraidOS 6.12.10)
  • Browser: Brave
  • Version: Cosmos Server v0.15.5
@engels74 engels74 added the bug Something isn't working label Apr 23, 2024
@engels74 engels74 changed the title [BUG]: Updating Docker images with a "base", that updates docker environment variables, doesn't change upon updating [BUG]: Updating Docker images (that uses a base image) seemingly doesn't update variables, when the base image does Apr 23, 2024
@azukaar
Copy link
Owner

azukaar commented Apr 23, 2024

Thanks for the throughout ticket! Really appreciate it
The main issue with this is that it's difficult to know what var the user has edited or not, the "overwriting" vars is normally a Docker thing (where you destroy the container, and re-create it without the var that the container has set in the first place), but because from the UI you update containers including the var the container has created, so Docker loses track of which one came from the container

@engels74
Copy link
Author

No problem 😁

Portainer apparently has the same issue, according to the hotio discord. Is there anything to do about it? 🤔

@azukaar
Copy link
Owner

azukaar commented Apr 24, 2024

Yeah I'd imagined so. Usually I try to fix even issues Portainer have in Cosmos, like this one : portainer/portainer#2657

But for this, I am really not sure what to do tbh... I think dev should not do this kind of stuff in the first place honestly, env var are here to document a deployement's specific settings. if something is an env var it means we should be fully prepared for users to customize it in the first place, that does not look like it's even possible here because the value is then hardcoded in the RUN command

The only thing that could be done that i can see is, if the app was in the market, updating the env var inside the compose in the market woudl actually fix the container if you updated it from the market, basically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants