Build a Nextcloud instance in Docker Compose complete with Redis and optional PostgreSQL
Go to file
James 2df8d080b3 add configurable frontend proxy network 2022-09-27 19:06:07 +01:00
nextcloud add previews config file 2022-01-31 22:44:18 +00:00
secrets replace mariadb with postgresql 2022-01-31 21:30:08 +00:00
.env.example add configurable frontend proxy network 2022-09-27 19:06:07 +01:00
.gitignore replace mariadb with postgresql 2022-01-31 21:30:08 +00:00
README.md update README with reverse proxy info 2022-02-27 16:19:06 +00:00
docker-compose.yaml add configurable frontend proxy network 2022-09-27 19:06:07 +01:00

README.md

Nextcloud (Docker Compose)

Build a Nextcloud instance in Docker Compose complete with PostgreSQL and Redis

Prerequisites

  1. Docker
  2. Docker Compose
  3. A reverse proxy on its own Docker network

Reverse Proxy Docker Network

This Docker Compose file assumes you have a reverse proxy (like Nginx) in a Docker container on another Docker network. If you are not using a reverse proxy or do not wish to use the Docker network to connect the reverse proxy, you can set the frontend network's external property to be false in docker-compose.yaml. You may also need to expose the HTTP port (80) on the nextcloud service.

Setup

  1. Create a copy of .env.example:
cp .env.example .env
  1. Replace the DOCKER_PROXY_NETWORK variable with the Docker network where your reverse proxy sits (see Reverse Proxy Docker Network)

  2. Replace the NEXTCLOUD_HOST variable with your desired domain

  3. Replace VOLUME_PATH variable if you wish to change where volume data is stored

  4. Modify other variables as needed

  5. Create the following required secrets files (you should consider restricting access to these files):

  • secrets/postgres_password.txt
  • secrets/nextcloud_admin_user.txt
  • secrets/nextcloud_admin_password.txt
  1. Bring up the containers!
sudo docker-compose -p nextcloud up --build -d
  1. (Optional) To enable some file previews copy previews.config.php into your Nextcloud's config directory (replace $volume with the path you have set in the VOLUME_PATH environment variable):
sudo cp nextcloud/previews.config.php $volume/var/www/html/config/
sudo chown www-data:root $volume/var/www/html/config/previews.config.php