Post

Raspberry Pi as your Cloud Storage - with Nextcloud & Docker

To install nextcloud in RPi, we need to include MariaDB in the installation (it supports ARM processors, not like mysql).

Installing Docker Stuff

First things first. Get Docker and Docker-Compose ready in your Rpi.

Deploy Nextcloud with Docker

Let’s use Docker-Compose to have nextcloud server installed without any complications:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: linuxserver/mariadb
    restart: always
    container_name: nextclouddb
    volumes:
      - /home/Docker/nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_INITDB_SKIP_TZINFO=1
      - MYSQL_ROOT_PASSWORD=rootpass
      - MYSQL_PASSWORD=ncpass
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
#    networks: ["nginx_nginx_network"] #optional 

  app:
    image: nextcloud #latest
    container_name: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - /home/Docker/nextcloud/html:/var/www/html
    environment:
      - MYSQL_PASSWORD=ncpass
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - NEXTCLOUD_TRUSTED_DOMAINS=http://0.0.0.0:8080 #https://nextcloud.yourduckdnsubdomain.duckdns.org/
#    networks: ["nginx_nginx_network"] #optional 
 
# networks: #optional
#   nginx_nginx_network: #optional
#     external: true #optional

FAQ

Remember to update the list of trusted domains so that other devices can log, we can see the current list with:

1
sudo docker exec --user www-data nextcloud_container php occ config:system:get trusted_domains

To add a new domain/internal/local ip, simply pass it in the end of this CLI command:

1
2
sudo docker exec --user www-data nextcloud_container php occ config:system:set trusted_domains 7 --value 192.168.1.22:8080
#sudo docker exec --user www-data nextcloud_container php occ config:system:set trusted_domains 7 --value nextcloud.yourgreatname.duckdns.org

Remember that you can check your device (the RPi here) internal IP adress with:

1
hostname -I

To access nextcloud while being out of home, simply configure your VPN, for example with tailscale, and add the internal Ip address assign by tailscale as shown two commands before.

You can also see your files with the WebDav, just add in your file manager:

1
2
davs://example.com/nextcloud/remote.php/dav/files/USERNAME/
davs://nextcloud.yourgreatname.duckdns.org/nextcloud/remote.php/dav/files/USERNAME/

If your server connection is not HTTPS-secured, use dav:// instead of davs://.

Alternatively - you can try FileBrowser

This post is licensed under CC BY 4.0 by the author.