nook24
October 31, 2021, 5:19pm
1
Hi, i plan to migrate my Nextcloud setup to the Apache based official Docker image and wanted to ask for the proper way to update the Docker installation. Do I just have to stop the container, run docker pull and restart it again, or do I install updates via the nextcloud web interface?
yes.
or use docker compose or watchtower or portainer . it’s easier that way.
that doesn’t work.
1 Like
nook24
November 1, 2021, 7:39am
3
Perfect, that was the answer I was hoping for! Many thanks.
I’m using portainer, but I also like to use systemd for this, like so:
ExecStartPre=/usr/bin/docker pull portainer/portainer-ce:latest
ExecStart=/usr/bin/docker run --rm [...] --name=portainer portainer/portainer-ce
@nook24 btw: this is the place where the “real” update happens.
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
fi
# shellcheck disable=SC2016
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then
echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?"
exit 1
fi
if version_greater "$image_version" "$installed_version"; then
echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then
echo "Upgrading nextcloud from $installed_version ..."
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi
if [ "$(id -u)" = 0 ]; then
rsync_options="-rlDog --chown www-data:root"
else
rsync_options="-rlD"
fi
watchtower breaks my Nextcloud every time there is an update.