dockcheck-web icon indicating copy to clipboard operation
dockcheck-web copied to clipboard

Update and pull new image on selected container via webgui

Open nodecentral opened this issue 2 years ago • 7 comments

Hi

Just installed your dockcheck(er) and really like it (thank you)

I noticed you have Update and pull new image on selected container via webgui listed as a future idea/feature. Do you have a timeline for when you think you will have that capability added ?

nodecentral avatar Feb 19 '23 13:02 nodecentral

Hi. Due to docker limitations I have some problem to actually make this work. Docker.sock need to take the container in down state and this makes it really hard to bring it up again. Docker.sock need to have the docker-compose file ready and if this is going to work today the dockcheck-web container need to have all the docker-compose files mounted. This makes it a security concern aswell.

I am working on it, but right now it seems not possible in the way I want it. Timeline is unknown right now.

If you feel like helping you are more than welcome.

Right now I am using mag's dockcheck script on my host to actually update all the images.

Palleri avatar Feb 19 '23 13:02 Palleri

If it helps, i run watchtower to do one-time updates, could that somehow be triggered via your UI ?

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once nginx redis

In the example above, watchtower will execute an upgrade attempt on the containers named "nginx" and "redis". Using this mode will enable debugging output showing all actions performed, as usage is intended for interactive users. Once the attempt is completed, the container will exit and remove itself due to the --rm flag

nodecentral avatar Feb 28 '23 20:02 nodecentral

Thank you for the feedback. Good idea, I will check how watchtower handle run-once.

Palleri avatar Feb 28 '23 22:02 Palleri

Does the underlying dockcheck.sh not do updates? Why do you have to implement anything for this? Genuine question.

Trevo525 avatar Mar 01 '23 00:03 Trevo525

I believe that this is what you'll want to look at for how watchtower does it btw.

Trevo525 avatar Mar 01 '23 00:03 Trevo525

Does the underlying dockcheck.sh not do updates? Why do you have to implement anything for this? Genuine question.

Hi, thank you for your feedback. I cannot run all commands docker is using inside a container due to limitations. Docker need to recreate the container to apply the new image. When you run docker-compose up it will need the docker-compose.yml file. Because the docker.sock is actually looking for the compose file where it runs it. How about docker-compose -f

docker-compose up -d -f /home/tester/docker-compose.yml does not work because the container does not have the path for the compose file inside the container

I do not want to mount all the compose files inside the container duo to security concern (sensitive data, tokens people might have in their compose files)

The original script dockcheck is working beacuase it is running on the host where all the compose files can be accessed.

We can use dockcheck script inside dockcheck-web to pull new images. But we cannot bring it up with the new image "docker-compose up" or even better docker-compose up -d --force-recreate; this is forcing compose to take the new image or new configurations.

Palleri avatar Mar 01 '23 14:03 Palleri

UPDATE: Update from webgui

Check out this new project DCW "new dockcheck-web"

DCW is also supporting exporters, "Multiple hosts and one webgui"

If you are moving from dockcheck-web to DCW for the first time, make sure to read the new readme

I have a prototype for this now.
It is working but only for single containers and only on the MAIN_DCW host for now.
If there is multiple services in a docker-compose it will not work as intended.
It will still update the container but it will not work until you restart the entire container stack.

Use palleri/dcw:develop

Use at your own risk, it might be smart to test this on a host with a few containers you are not afraid to lose.

There is no warning when you press the update button beside a container, it will just run so be careful!

The script will preserve all the configurations from the old container. I say "all" becuase it should, but this might not be true.

I have tested this with Lazydocker to have a overview over the container being updated. While having this open and used the Update button on the webpage.

When you press the button it will:

  • save configurations of the selected container.
  • remove the old container.
  • pull the new image.
  • start the new container with the new image and the old configurations.

This will take you back to the main page, press the check for updates button to see if the changes has been made. When check for updates is finished the container should no longer be in the Containers with updates available: column

It should also preserve volumes and environment variables/files.
I need help to bugcheck this. Test it as hard as possible if you guys have time for it.

Palleri avatar Mar 14 '23 12:03 Palleri