This is the most complete resource I’ve yet come across for setting up Nextcloud in a Docker container. Thank you @KarlF12! I’ve used it as the basis for my own docker-compose.yml
to set up Nextcloud which, at the time of writing this post, is at version 19.0.1.
version: '3.7'
networks:
nextcloud:
services:
nextcloud:
image: nextcloud
container_name: nextcloud
networks:
- nextcloud
ports:
- 8000:80
volumes:
- ${NEXTCLOUD_ROOT}/html:/var/www/html
- ${NEXTCLOUD_ROOT}/apps:/var/www/html/custom_apps
- ${NEXTCLOUD_ROOT}/config:/var/www/html/config
- ${NEXTCLOUD_ROOT}/files:/svr/nextcloud/data
- ${NEXTCLOUD_ROOT}/themes:/var/www/html/themes
# extra_hosts:
# - ${NEXTCLOUD_FQDN}:${NEXTCLOUD_IPADDRESS}
depends_on:
- mariadb
- redis
environment:
# - NEXTCLOUD_TRUSTED_DOMAINS='${NEXTCLOUD_FQDN}'
- NEXTCLOUD_DATA_DIR=/svr/nextcloud/data
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_HOST=nextcloud-mariadb
- REDIS_HOST=nextcloud-redis
- TZ=Australia/Perth
- REDIS_HOST_PASSWORD=${REDIS_PASSWORD}
restart: unless-stopped
mariadb:
image: mariadb
container_name: nextcloud-mariadb
volumes:
- ${NEXTCLOUD_ROOT}/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=nextcloud-mariadb
- TZ=Australia/Perth
networks:
- nextcloud
restart: unless-stopped
redis:
image: redis
container_name: nextcloud-redis
command: redis-server --requirepass ${REDIS_PASSWORD}
networks:
- nextcloud
restart: unless-stopped
The main difference is, it now seems that Redis password authentication is a requirement, otherwise, the following errors appear in logs:
The clue was in this thread [SOLVED] Latest Docker image broke the installation (Redis password auth)
My question is around the bits of the compose file that I’ve commented out.
-
I’m not sure of the value of the
extra_hosts:
key. I’ve not noticed any visible difference by removing it. -
Autoconfiguration using the environment variable NEXTCLOUD_TRUSTED_DOMAINS does not appear to work. A check of the trusted_domains array in
config.php
confirms this.
Would you care to comment on these points please?