Nextcloud Docker container

I have been getting a quite a lot of comments on the post TurnKey Linux’ Nextcloud container on Proxmox. Since I switched to the official Nextcloud container for several months now, I thought I would update my Nextcloud deployment. The reason I used the official Docker container was the update process. It is very easy to update the official container compare to Linuxserver container or Turnkey Linux instance.

Here is how to upgrade the official Docker container:

docker-compose pull
docker-compose up -d

Now, just like any other Docker container I use docker-compose. I have to files which are the .yaml file and an .env file. I use the .env file to keep most of the configs that I do not want to share. It is easier to post the docker-compose.yml with variables to reddit or forums and no need to clean it up since all the important value are in the .env file.

Here is the docker-compose.yml file that I am using.

version: '3'

services:
  nc_db:
    image: mariadb:10.5.12
#    image: postgres
    restart: unless-stopped
    env_file: .env
    networks:
      - nc_backend
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - ${APPDATADB}:/var/lib/mysql
#      - ${APPDATADBP}/var/lib/postgresql/data
    environment:
      - MYSQL_ROOT_PASSWORD=${PASSROOT}
      - MYSQL_PASSWORD=${DBPASSUSER}
      - MYSQL_DATABASE=${DB}
      - MYSQL_USER=${DBUSER}
      #- POSTGRES_DB=${DB}
      #- POSTGRES_USER=${DBUSER}
      #- POSTGRES_PASSWORD=${DBPASSUSER}

  nc_app:
    image: nextcloud #:stable
    restart: unless-stopped
    env_file: .env
    networks:
      nc_frontend:
      nc_backend:
    ports:
      - ${PORT}:80
    depends_on:
      - nc_db
    volumes:
      - ${APPDATA}:/var/www/html
      - ${DATA}:/data
    environment:
      #- POSTGRES_DB=${DB}
      #- POSTGRES_USER=${DBUSER}
      #- POSTGRES_PASSWORD=${DBPASSUSER}
      #- POSTGRES_HOST=nc_db
      - MYSQL_PASSWORD=${DBPASSUSER}
      - MYSQL_DATABASE=${DB}
      - MYSQL_USER=${DBUSER}
      - MYSQL_HOST=nc_db
      - NEXTCLOUD_ADMIN_USER=${NCADMIN}
      - NEXTCLOUD_ADMIN_PASSWORD=${NCADMINPASS}
      - NEXTCLOUD_DATA_DIR=/data
      - NEXTCLOUD_TRUSTED_DOMAINS=${NCTRUSTEDDOMAIN}
      - SMTP_HOST=${MAILHOST}
      - SMTP_SECURE=${MAILSECURE}
      - SMTP_PORT=${MAILPORT}
      - SMTP_NAME=${MAILNAME}
      - SMTP_PASSWORD=${MAILPASS}
      - MAIL_FROM_ADDRESS=${MAILFROM}
      - APACHE_DISABLE_REWRITE_IP=1
      - TRUSTED_PROXIES=${TRUSTEDPROXIES}
      - OVERWRITEHOST=${OVERSWRITEHOST}
      - OVERWRITEPROTOCOL=${OVERWRITEPROTOCOL}
      - PHP_MEMORY_LIMIT=8G
      - PHP_UPLOAD_LIMIT=10G

networks:
  nc_frontend:
  nc_backend:

This is the sample contents of the .env file. Adjust the values to the desired values.

# mariadb
PASSROOT=root$3cretP@5sw07d
DBPASSUSER=dbu$3r$ec73tP@s5w0rd
DBUSER=ncdbuser
DB=nextcloud
APPDATADB=/srv/appdata/nextcloud/nextcloud_db

# postgres
#DBPASSUSER=dbu$3r$ec73tP@s5w0rd
#DBUSER=ncdbuser
#DB=nextcloud
#APPDATADBP=/srv/appdata/nextcloud/nextcloud_db

# nextcloud
PORT=8084
APPDATA=/srv/appdata/nextcloud/nextcloud_app
DATA=/mnt/pool/nextcloud
NCADMIN=ncadmin
NCADMINPASS=nC@dm1nS3cr37p@%swOrd
NCTRUSTEDDOMAIN=192.168.7.9:8084 nextcloud.example.tld
MAILHOST=smtp.gmail.com
MAILSECURE=tls
MAILPORT=587
[email protected]
[email protected]
MAILPASS=abcdefghij123456789
TRUSTEDPROXIES=['192.168.20.11']
OVERSWRITEHOST=nextcloud.example.tld
OVERWRITEPROTOCOL=https

One last thing. When upgrading the Nextcloud instance and got the page stating the Nextcloud is in Maintenance Mode, run the following command. This will turn off the maintenance mode and the web UI just follow the prompt then you should be good to go.

docker-compose exec -u www-data nc_app php occ maintenance:mode --off

If you are using NGINX Proxy Manager, make sure to add these lines to the Advanced tab.

ssl_protocols TLSv1.2 TLSv1.3;
client_max_body_size 0;
proxy_request_buffering off;

Cheers!

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x