Skip to content

Instantly share code, notes, and snippets.

Last active June 5, 2024 04:31
Show Gist options
  • Save ichiTechs/83e228fa1e6c83543623a1bf06f3eb32 to your computer and use it in GitHub Desktop.
Save ichiTechs/83e228fa1e6c83543623a1bf06f3eb32 to your computer and use it in GitHub Desktop.
NextCloud with Maria DB docker-compose file
# NextCLoud with MariaDB/MySQL
# Access via "http://localhost:80" (or "http://$(docker-machine ip):80" if using docker-machine)
# During initial NextCLoud setup, select "Storage & database" --> "Configure the database" --> "MySQL/MariaDB"
# Database user: nextcloud
# Database password: nextcloud
# Database name: ncdb
# Database host: replace "localhost" with "maria-db" the same name as the data base container name.
# The reason for the more refined data persistence in the volumes is because if you were to
# use just the the '/var/www/html' then everytime you would want/need to update/upgrade
# NextCloud you would have to go into the volume on the host machine and delete 'version.php'
version: '2'
container_name: nextcloud
restart: unless-stopped
image: nextcloud
- 80:80
- /containers/cloud/nextcloud/apps:/var/www/html/apps
- /containers/cloud/nextcloud/config:/var/www/html/config
- /containers/cloud/nextcloud/data:/var/www/html/data
- db
container_name: maria-db
restart: unless-stopped
image: mariadb
MYSQL_USER: nextcloud
- /containers/cloud/mariadb:/var/lib/mysql
Copy link

how to enable https

Copy link

askiiart commented May 1, 2023

how to enable https

Use a reverse proxy, I'd recommend caddy.

Copy link

tocram1 commented Jul 10, 2023


Trying to get this setup but I get this when entering the databse information during the initial setup.

SQLSTATE[HY000] [1130] Host '' is not allowed to connect to this MariaDB server

I have this exact same problem. I'll try adding this to the db service and see if it fixes it :

command: mysqld --bind-address=

Copy link

ghost commented Nov 7, 2023

How can I backup the data directory? Everything in it is owned by www-data so none of my backup solutions can get access. I’ve added my user to the www-data group but it still doesn’t work

Copy link

How do I update to the latest version of Nextcloud?

Copy link

@sailing12388 just pull the latest version of the image and recreate the container. IIRC, this should do both:

docker compose up -d --pull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment