qnap-dev / container-apps

Apache License 2.0
80 stars 218 forks source link

How to upgrade existing container app #53

Closed fracz closed 6 years ago

fracz commented 6 years ago

I have managed to create a config that works with Container Station. But I cannot figure out how to update existing, already installed application to a new version when new containers are published on Docker Hub? Uninstalling the app and installing it again from provided configuration causes lost of all data because volumes mapped from containers are being removed during the uninstall process, too.

fcwu commented 6 years ago

You may try

  1. Stop all containers of App
  2. ssh to NAS, edit /share/Container/container-station-data/application//docker-compose.yml to your preferring version in image field
  3. Start the app

NOTE: some app may not work properly after you upgrade. Please do this carefully.

BTW, Container Station v1.8 will have an editor UI for editing docker-compose.yml. It will be released soon.

fracz commented 6 years ago

I can upgrade, but I think about users that do not want to or cannot "SSH to NAS".

The version of the container is often not directly specified in the yml file, so the container version is "freezed" to whatever was the latest vesrion during the first installation. IMO, Container Station GUI should allow to upgrade containers by simply calling docker-compose pull & restarting them.

Also, if docker-compose.yml configuration changes for some reason and is updated in the repo, there is no way to apply it to existing installations, am I right?

Will CS v1.8 also update Docker and Docker Compose to newer versions?

fcwu commented 6 years ago

@fracz v1.8 is public now

[New Features]

[Fixed Issues]

scrobbleme commented 5 years ago

@fracz

  • A user interface is now provided for users to create applications using the Docker Compose yaml format.

Missing this features as well. Makes it quite harder to use.

aristotelez commented 5 years ago

Hi, I don't know if I just don't get it or if there still is no way to update a existing, already installed application to a new version pull Docker Hub through the Container Station GUI...

scrobbleme commented 5 years ago

@aristotelez No, it's still not possible.

caltuntas commented 5 years ago

As it's specified in comments above, still not possible to update existing image via GUI. Why is this issue closed at all ?

wbaeck commented 5 years ago

Having the same request. So please reopen the issue!

scrobbleme commented 5 years ago

Here is a short "workaround" on upgrading using the UI:

Important: All your data is in volumes and you have backups.

  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)
  5. start the new container
  6. Check -> if everything is fine -> delete your old container (and base image)

(btw. this also works, if you did something wrong in the first place, but already have some data)

jostrasser commented 5 years ago

Yes, please reopen the issue and bring a solution. Thanks

aristotelez commented 5 years ago

[...] Why is this issue closed at all ?

Legitimate question...

Matt-PMCT commented 5 years ago

agreed, why is there not a simple way to update a container to newest version of "latest"

ghost commented 5 years ago

Yes, just make the image field editable - everything else should work.

drivera73 commented 5 years ago

One can trigger a pull of an existing image, but apparently ContainerStation simply stops at comparing the version numbers, vs. version number and hash. Thus, "latest" == "latest" every time, instead of checking against the image version's hash from the repository.

That would simplify matters significantly.

dskvr commented 5 years ago

Haha classic QNAP...

/share/Container/container-station-data/application/

This directory is empty

After further investigation, it would appear more recent versions of Container Station have abandoned docker-compose.yml altogether, (which IMO would be the correct implementation in this situation)

The values that would have otherwise existed in docker-compose are spread across multiple json files in a format that appears to be proprietary to Container Station's janky and unmanageable implementation;.

The location of the relevant config files for Container Station 2.0.356 are all now in /share/Container/container-station-data/lib/docker/containers/ inside a directory with a sha256 hash, for example: 229b8236d4abf32e06215c216eac63e352c42fc1c5b1eb2c79e57bf793d5fbd4

There are a messy collection of files that have often redundant information. I'm not 100% sure, but it does appear the redundancy is due to the different purposes of these configuration files.

  1. qnap,json appears to the file where the configuration settings are applied from the Container Station GUI.
  2. hostconfig.json looks to be a file that is built based on a number of proprietary conventions and rules for QTS-style bindings.
  3. config.v2.jsonSimilar to the JSON file above, appears to be a file that is built from qnap.json but this one contains values that would be consumed by docker run runtime arguments. I haven't yet tested it, but it is likely that it would be here you could reference a new image. The upgrading of the image would have to still be completed via CLI.
fracz commented 5 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
drivera-armedia commented 5 years ago

Yes. I know that. The point is that this procedure is simple enough that the QNAP UI should provide an option/button to do it easily...

fracz commented 5 years ago

Yup, I know and still waiting for such option in Container Station. However, it was not obvious to me that docker-compose pull and restarting containers is not enough for them to really update like @drivera73 has mentioned. Thus - posted the only solution that worked for me.

dskvr commented 5 years ago

/share/Container/container-station-data/application/ is empty in recent versions of Container Station

[~] # ll /share/Container/container-station-data/application/
total 8.0K
drwxr-xr-x 2 admin administrators 4.0K 2019-08-17 15:39 ./
drwxr-xr-x 7 admin administrators 4.0K 2019-05-28 14:05 ../

As mentioned in my post, details that would otherwise be inside a docker-compose.yaml file are now found in some pretty hacky looking json files:

[~] # ll /share/Container/container-station-data/lib/docker/containers/229b8236d4abf32e06215c216eac63e352c42fc1c5b1eb2c79e57bf793d5fbd4/
total 824M
drwx------ 4 admin administrators 4.0K 2019-08-18 19:14 ./
drwx------ 4 admin administrators 4.0K 2019-08-17 16:15 ../
-rw-r----- 1 admin administrators 824M 2019-08-21 15:26 229b8236d4abf32e06215c216eac63e352c42fc1c5b1eb2c79e57bf793d5fbd4-json.log
drwx------ 2 admin administrators 4.0K 2019-07-04 11:51 checkpoints/
-rw------- 1 admin administrators 5.3K 2019-08-18 19:14 config.v2.json
-rw-r--r-- 1 admin administrators 1.3K 2019-08-18 19:14 hostconfig.json
-rw-r--r-- 1 admin administrators    9 2019-08-18 19:14 hostname
-rw-r--r-- 1 admin administrators  162 2019-08-18 19:14 hosts
-rw-r--r-- 1 admin administrators  822 2019-08-18 19:14 qnap.json
-rw-r--r-- 1 admin administrators  785 2019-08-18 19:12 qnap.json.orig
-rw-r--r-- 1 admin administrators   20 2019-08-18 19:14 resolv.conf
-rw-r--r-- 1 admin administrators   71 2019-08-18 19:14 resolv.conf.hash
drwxrwxrwt 2 admin administrators   80 2019-08-18 19:14 shm/

@fracz What version of Docker Station and QTS are you running?

s0uls commented 5 years ago

Same issue over here, with latest QTS and container station

dskvr commented 5 years ago

~Moral of the story: Don't buy anything from QNAP, they don't support their products.~

Was a bit harsh. QTS has however been a nightmare for me.

drivera73 commented 5 years ago

I disagree, @dskvr . I've gotten good support from them the other times I've needed it.

But they're lacking some very simple usability features that would go a long way towards improving their products. This is one. Another is the UPS auto-shutdown/auto-protect feature that is only time-based, and can't be configured to respond to UPS battery percentage (which, in my mind, is far more useful). There are plenty others, I'm sure, but those are the two that jump right to my mind b/c those are the two I've had to deal with most in recent times.

Koramchad commented 4 years ago

Was hoping to follow the instructions in here to update my 3 Tautulli containers in my Qnap, but got stuck just like @dskvr explained. Any info on how to proceed with the manual update? Seems like @fracz was onto something, but haven't seen any updates to his last instructions... Thanks!

oywino commented 4 years ago

I have tried to edit the config.v2.json file in a desperate attempt to add a service command to a Ubuntu container to be run upon startup of the container. After; Edit --> File Save --> Stop/Start CS, I can see the modifactions I have done to Entry Point as well as Command when I inspect the settings for that container using CS GUI. But my problem is that whatever I type there, it doesn't seem to have any effect. There are no indications that the service command is in fact executed upon container restart. I have of course ensured that the command is valid. I can type it manually in the console window and it works. What I am uncertain of, is the difference between Entry Point and Command and if any particular syntax or dependency issues needs to be met. Please help, anyone.

gmanc2019 commented 6 months ago

Update QNAP container stations docker-compose application using the following commands. Tested 15/04/2024 and works.

SSH into your machine. E.g. Location below CACHEDEV1_DATA likely different on your own QNAP, to do with volumes on the device.

/share/CACHEDEV1_DATA/Container/container-station-data/application/{name of your application}

Edit docker-compose.yml using a command line editor like vi or equivalent.

Update the image with a new tag or image name (e.g. below)

version: '3' services: portainer: container_name: portainer image: portainer/portainer-ce:alpine ports:

- host:container

  - "9000:9000"
restart: always

I stopped the container using the GUI in container station 3. I seem to have all other options greyed out:- "this operation is not supported on containers created using the Compose Function"

(not a type-o) (QNAP actually uses 'docker compose' instead of 'docker-compose' as command) (run following commands in the same directory as your docker-compose.yml you updated in last step)

docker compose pull docker compose up -d

Now you container image updated and working. Enjoy. I had to piece this together from multiple posts.