I know you want to us to pull the new image to update because you want the php dependencies updated, but quite frankly that procedure is a real hassle. In synology, to do it via gui requires a number of steps, it can't be automated, and it's a hack at best. For security purposes I don't enable ssh access to my server outside of the lan, so it can only be done if I'm at home, plus it's just unnecessarily cumbersome.
Other docker containers allow updates, is there no way nextcloud can work that out?
I also run Nextcloud in docker on my Synology. Updating through command line works like a charm and is faster than using the GUI, plus it ensures that all dependencies (e.g. Apache, PHP...) are up to date too. A quick SSH login, two commands and you'll be running the latest.
Updates in a Docker Container is a no-go. Is has nothing to do with php
dependencies etc. This is how Docker works (no persistent data in Containers).
Thanks for the comment @menteb . Is it these commands? I got those from the documentation. Just after my last upgrade failed via the gui, want to make sure i get it right.
$ docker pull nextcloud
$ docker stop
$ docker rm
$ docker run
@a575606 Yes, unless you work with a docker compose file, in which case the commands would be:
$ docker-compose pull
$ docker-compose up -d
This will pull the new Nextcloud image, extract it and the 2nd command will start the container.
Hi @menteb Thanks for the response. And forgive the noob questions. I only recently upgraded to hardware fast enough to handle docker properly, so there's a lot I'm still learning.
I have no problem using the cli, but for the most part I use the gui to create and manage containers. The only downside to that is I'm not always sure what the gui is doing under the surface. So I sort of skimmed the section on creating docker containers and using docker compose in the command line. Do you happen to know what dsm does in regards to compose when creating a container?
@a575606, I've always used docker compose on DSM. It gives you more flexibility to for instance connect Redis, Nextcloud cron and Traefik as reverse proxy.
Below my docker-compose.yml file.
Make sure that you have the following directories present:
And create a network (in my case I used "net").
All you need to do after that is to run:
$ docker-compose up -d
docker-compose.yml:
version: '3.2'
services:
nextcloud:
image: nextcloud
container_name: nextcloud
restart: always
networks:
- net
ports:
- <pick a high port that is not in use>:80
labels:
- "traefik.docker.network=net"
- "traefik.enable=true"
- "traefik.backend=nextcloud"
- "traefik.port=80"
- "traefik.protocol=http"
- "traefik.frontend.rule=Host:your.domain.tld"
- "traefik.frontend.headers.customResponseHeaders=Strict-Transport-Security:15552000"
- "traefik.frontend.passHostHeader=true"
- "traefik.frontend.redirect.permanent:true"
- "traefik.frontend.redirect.regex:https://(.*)/.well-known/(card|cal)dav"
- "traefik.frontend.redirect.replacement:https://$$1/remote.php/dav/"
depends_on:
- nextcloud_db
volumes:
- nextcloud:/var/www/html
- config:/var/www/html/config
- data:/var/www/html/data
- themes:/var/www/html/themes
environment:
- "MYSQL_HOST=nextcloud_db"
- "NEXTCLOUD_TRUSTED_DOMAINS=your.domain.tld"
- "REDIS_HOST=nextcloud_redis"
depends_on:
- nextcloud_db
- redis
nextcloud_db:
image: mariadb
container_name: nextcloud_db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
networks:
- net
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=<root_password>
- MYSQL_PASSWORD=<password>
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
redis:
image: redis
container_name: nextcloud_redis
networks:
- net
cron:
image: nextcloud
container_name: nextcloud_cron
restart: always
networks:
- net
volumes:
- nextcloud:/var/www/html
entrypoint: /cron.sh
depends_on:
- nextcloud_db
- redis
volumes:
nextcloud:
nextcloud_db:
nextcloud_cron:
networks:
net:
external: true
IF you see that Nextcloud complains about carddav or caldav, you can also change the following in nextcloud/.htaccess
Replace:
RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
By:
RewriteRule ^\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
When there is a Nextcloud update, run:
$ docker-compose pull
$ docker-compose up -d
IF you have more domains/IPs pointing to the same Nextcloud, then you can add them in the docker-compose.yml space separated:
- "NEXTCLOUD_TRUSTED_DOMAINS=your.domain.tld"
If that doesn't seem to work, you can add the following to config/config.php under Trusted Hosts.
1 => '<IP address or domain>'
Then run the following to make changes to the database (if needed, see Nextcloud):
sudo docker exec --user www-data nextcloud php occ db:convert-filecache-bigint
This works for me. Hope it works for you too.
There is a docker container, that updates all containers automatically:
https://hub.docker.com/r/v2tec/watchtower/
Most helpful comment
Updates in a Docker Container is a no-go. Is has nothing to do with php
dependencies etc. This is how Docker works (no persistent data in Containers).