qnap-dev / container-apps

Apache License 2.0
80 stars 218 forks source link

Update existing container to newer Docker Hub build (like issue #53) #78

Open aristotelez opened 5 years ago

aristotelez commented 5 years ago

Hi, I have managed to set up some Docker Containers with Container Station. But I cannot figure out how to update those existing, already installed applications to a new version from Docker Hub. As I am not an expert in Docker Containers, but some of the Containers are exposed to the WWW I need to keep them up to date without having to reconfigure the containers every time...

TotalNet commented 5 years ago

Similar complaint here. Running a container on a TS-451+ for my UniFi controller (jacobalberty/unifi:latest) to great effect and one of the reasons I chose QNAP. So I'm rather disappointed that I can't use a standard Docker feature (as I understand it) to pull an updated version of the image to stay up to date.

I have submitted a support request on this so who knows if this is in progress but issue 53 was created almost 18 months ago and closed without resolution.

When I go to Images and pull the image as "latest" it does nothing, I guess because it already has (an old version of) it against an existing container (albeit stopped) but it will pull 5.10.25 and "stable" if I specify that tag

Please enable this feature, container station is a great way to get the most from an always on QNAP NAS but if we can't keep the versions up to date without creating a new container then it's a bit of a fail

ralban commented 5 years ago

Same issue. Has anyone identified a work-around to upgrade an existing container? (e.g., stop the container, delete the image, re-pull the latest image, restart container?).

fracz commented 4 years ago

In order to upgrade app to the real latest version, one needs to ssh into the QNAP and:

cd /share/Container/container-station-data/application/your-app-name
docker-compose pull
docker-compose up --build -d

Still, waiting for "normal" way of doing this in QTS.

scrobbleme commented 4 years ago

Same issue. Has anyone identified a work-around to upgrade an existing container? (e.g., stop the container, delete the image, re-pull the latest image, restart container?).

As a workaround you can just create a new container with the exact same settings. The most important things: your data in volumes and backups. The procedure itself just takes a couple of minutes (if you are "trained")

  1. Pull the newer image of your container
    1. Recommendation: always specify the exact version and not just "latest", so you will later know the version you used.
  2. Stop the original container
  3. Make a backup of your data
  4. Create a new container with exact the same configuration as your original one (basically copy & paste from the configuration UI)
  5. start the new container
  6. Check -> if everything is fine -> delete your old container (and base image)

... still only a workaround

mdkathon commented 4 years ago

In order to upgrade app to the real latest version, one needs to ssh into the QNAP and:

cd /share/Container/container-station-data/application/your-app-name
docker-compose pull
docker-compose up --build -d

Still, waiting for "normal" way of doing this in QTS.

Odd, I'm looking for my Unifi controller to update it and does not appear here. Looks like there is a bunch of stuff found in /share/Contianer/container-station-data/lib/docker but I'm still unable to find the application space.

[/share/Container/container-station-data/lib/docker/containers] # ls /share/Container/container-station-data/application/
[/share/Container/container-station-data/lib/docker/containers] # pwd
/share/Container/container-station-data/lib/docker/containers
[/share/Container/container-station-data/lib/docker/containers] # ls
65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43/
[/share/Container/container-station-data/lib/docker/containers] # cd 65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43/
[/share/Container/container-station-data/lib/docker/containers/65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43] # ls
65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43-json.log  config.v2.json   hostname  qnap.json    resolv.conf.hash
checkpoints/                                                               hostconfig.json  hosts     resolv.conf  shm/
[/share/Container/container-station-data/lib/docker/containers/65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43] # cd shm
[/share/Container/container-station-data/lib/docker/containers/65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43/shm] # ls
[/share/Container/container-station-data/lib/docker/containers/65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43/shm] # cd ..
[/share/Container/container-station-data/lib/docker/containers/65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43] # cat hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.xx.xx.xx     UniFiController
[/share/Container/container-station-data/lib/docker/containers/65ed5f4e03097e6001ea0d3c474cbd98ab8711162bc2cd06adb026374e2c7f43] #
jairbubbles commented 4 years ago

To complement @scrobbleme's solution you can also create a new container with the newest version. This will create new volumes and you just need copy the content of the old volumes (mainly config/) into the new ones which is safer as you don't touch your original environment.

Here is a detailed guide:

image

image

NB: if you change the port configuration, it creates a new image and new volumes so you'll need to do that again

tjandras commented 4 years ago

I use portainer to manage my containers on my qnap. It needs a little configuration (there was a guide on the internet) but everything is much easier after using portainer. On the other hand I have the same problem when I need/want to update portainer (it cannot update itself).

Lqp1 commented 3 years ago

I'm in same case as most of people here. Using portainer is fine but honestly it's a bit overkill.

Can someone from QNAP give some insights on when this feature could arrive in container-station? or at least if this is something that QNAP is going to work on or not?

@tjandras to update portainer I create an App using a yaml file using UI; when I need to update I delete the app and recreate-it. Not automatic but I think this is fine for portainer as I don't expose it directly.

riccardospeggiorin-centropaghe commented 3 years ago

So still no way to upgrade an image of a container? I have the same problem of upgrading unificontroller on qnap, and still nothing found in /share/Container/container-station-data/application/your-app-name I don't want to mess up the current container, so I am glad to find a goog guide to how to.

ril3y commented 3 years ago

@walkerlee @walkerlee-qnap Can you guys get with it? We want a way to update the images after creation from the container station. This is not a hard thing to do. Or opensource the code so we can do this. Spend $2.5k on this NAS and it's great, however, this is just ridiculous. Look @jairbubbles 's approach here.. Can you even imagine the tech support you guys are paying to deal with people screwing up a command to do something that should be super basic?

TotalNet commented 3 years ago

2 years on...

If it's too difficult for you or, more likely extremely low priority, then is there another Docker app that could be supported instead?

I've resorted to buying a couple of Raspberry Pis for the apps I use that support it but might look at a dedicated docker system on NUC running Linux

When I upgrade to a larger NAS I'm sorry to say it wont be a QNAP, I don't know if Synology are better but it'll be something designed as a NAS and not some wanna-be appliance server come NAS.

jairbubbles commented 3 years ago

@ril3y I use portainer too now to update... and I don't backup my volumes before because I'm too lazy 🥱

TotalNet commented 3 years ago

I have the same problem of upgrading unificontroller on qnap, and still nothing found in /share/Container/container-station-data/application/your-app-name

Unifi Controller is manageable if you back up the config from the controller itself (backup data is optional), create a new container and import the config to the new container - assign the same MAC address to the container and you'll be upgraded in no time. I'm looking at getting a Dream Machine Pro which will make this redundant but a Cloud Key could also be a way to go. Also using Pi Hole, now switched to using an actual Pi but this is all extra power/network physical cables.

There's potential for an always-on device like a NAS that it can host these "light service" type apps that don't demand much of the CPU and come with a ton of "local" storage without any extra physical devices, saving on space and power. And Docker is the most flexible way to do this!

jon-eric commented 3 years ago

I followed QNAP's tutorial for setting up a UniFi Controller. But I now think it's missing a crucial step.

When you create the container, it's important to create a named volume for the data you want to keep: image

jacobalberty/unifi-docker's README mentions this:

This is a containerized version of Ubiqiti Network's Unifi Controller.

The following options may be of use:

  • Set the timezone with TZ
  • Bind mount the data and log volumes

That last bullet means you're expected to redirect at least the data and logs directories (I redirected their parent, unifi, directory) to somewhere outside of the container. If you don't do that, the data you want gets written into the container, which you don't want because the container is expected to be disposable.

With a named volume, you can upgrade by destroying and re-creating the container.

TotalNet commented 3 years ago

Can't believe this is 2 years on and still no word from QNAP, perhaps most users just slap in a few drives and never use these features. I'll have a look around for an appliance server option I think, one that properly supports docker. Don't get me wrong, I have no complaints about the performance and durability of this as a NAS product, but, the value adds don't seem to have much value and my product options would look different if I'd known this up front.

DIYglenn commented 3 years ago

Totally agree. I started with Docker on QNAP, and couldn't believe what the hype was all about, considering how clunky it was - until I learned that QNAP hasn't really implemented Docker support for other than "testing" it.

It is SO annoying that you can't just pull a new image. There is a pull button, but you can't choose the existing images.

Drallas commented 2 years ago

I also had to spin up a portainer-ce container, to be able to properly manage the rest of my container.

Mapping the docker.sock also couldn't be done via the gui, so i had to resort to the command line as Matthias Seifert figured out.

docker run -d --restart=unless-stopped -p 8000:8000 -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer:/data --name portainer-ce portainer/portainer-ce:latest

It would indeed be nice if QNAP builds the container update functionality into the Containerstation App!