Nextcloud in Docker

docker-compose

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb:10.5
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - ./db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=<password1>
      - MYSQL_PASSWORD=<password1>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - ./nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=<password1>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - NEXTCLOUD_ADMIN_PASSWORD=<password2>
      - NEXTCLOUD_ADMIN_USER=admin
      - NEXTCLOUD_TRUSTED_DOMAINS=localhost <ip_address1> <ip_address2> <hostname1> <hostname2>

Commands

How to add, query, or set new trusted domains

docker compose exec --user www-data app php occ config:system:get  trusted_domains
docker compose exec --user www-data app php occ config:system:get  trusted_domains 0
docker compose exec --user www-data app php occ config:system:set  trusted_domains 4 --value=<hostnameorip>

Getting certs

sudo tailscale cert –cert-file cert.pem –key-file key.pem <server.domain>.ts.net

External Resources

Docker-Compose info

Upgrading Nextcloud on Docker

SSL resources