I just tried installing nextcloud for the first time using the docker compose file available on github which uses nginx and let’s encrypt. I made a couple modifications, as I want to have a custom directory for all the data. I can log in to nextcloud and I see the first log in page. I enter log-in credentials, but instead of creating a user, it spits out the following error:
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away
I’m not sure where to start with this, since the docker container for the database seems to be running properly.
Below is the docker compose file I used:
version: '3'
services:
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=*password*
- MYSQL_PASSWORD=*password*
- MYSQL_DATABASE=nextclouddb
- MYSQL_USER=nextcloud
env_file:
- db.env
app:
image: nextcloud:apache
restart: always
volumes:
- nextcloud:/var/www/html
- data:/home/anytimesoon/Media/Nextcloud
environment:
- VIRTUAL_HOST=*serveraddress*
- LETSENCRYPT_HOST=*serveraddress*
- LETSENCRYPT_EMAIL=*myemail*
- MYSQL_HOST=db
env_file:
- db.env
depends_on:
- db
networks:
- proxy-tier
- default
proxy:
build: ./proxy
restart: always
ports:
- 80:80
- 443:443
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
volumes:
- certs:/etc/nginx/certs:ro
- vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- proxy-tier
letsencrypt-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes:
- certs:/etc/nginx/certs
- vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- proxy-tier
depends_on:
- proxy
volumes:
db:
data:
nextcloud:
certs:
vhost.d:
html:
networks:
proxy-tier:
What have I done wrong? How can I fix this?