Closed firstof9 closed 4 years ago
I think you basically like to create a container via monitor_docker. Technically the aiodocker library I use, should this. Only it will become a bit complex (I can't really validate if the input is "good" enough), so I need to think about it if it is really a useful service to add.
Fair enough, you really wouldn't need to validate the input since it would be coming from an already created container. Only validation needed would be to make sure the container name existed to pull the config from.
I will check if the underlying aiodocker library can do this (re-using the old settings), but it looks more a task for watchtower?
I maybe a single use case, but I would like to be able to hit "Upgrade Home Assistant" button from my UI and have it recreate the container with the latest image without having to use a command_line switch and bash script.
If you can't swing it no worries. It was just an idea.
aiodocker doesn't support the required rename feature, I will try to make a PR for that one first (and see if they accept it).
+1 for this. I'm not familiar with the Docker API, but is it possible for this to read an existing compose file?
@colemamd Sorry, it isn't that easy to re-create a container. Neither doing it via docker-compose, you could make a shell command in HA to trigger docker-compose?
@firstof9 I have looked deeper in the Docker API and aiodocker, but it is not easy to do such re-creation (there is no 1:1 possible, because the names and datatypes are all different). If you are willing to make a PR yourself, I happy to merge it.
Thanks for looking into it!
I would love to see a service added to this to allow containers to pull the latest image, then recreate the container based on the Json data under
Config
from the docker API.