Installing Nextcloud on a Raspberry Pi Using Docker

Introduction: Installing Nextcloud on a Raspberry Pi Using Docker

This instructable is now out of date, for an up to date tutorial please visit my github.

Supplies

- Raspberry Pi (3 or 4 would be best)

- Micro SD card (min 8GB)

- Raspberry Pi power supply

- Ethernet Cable

- DNS Domain

Step 1: Old Tutorial

Be the First to Share

    Recommendations

    • Soup & Stew Speed Challenge

      Soup & Stew Speed Challenge
    • Lamps and Lighting Contest

      Lamps and Lighting Contest
    • Metal Contest

      Metal Contest

    20 Comments

    0
    JianyuanM
    JianyuanM

    Question 3 months ago on Introduction

    Thank you for such a detailed tutorial. But I have some problems when I follow up the steps:
    1. I got the error "no matching manifest for linux/arm/v7 in the manifest list entries" with the mariadb docker image. So I changed to jsurf/rpi-mariadb.
    2. Nextcloud was running but not populate to outside, which means http://ip was not access the nextcloud but the Congratulation page of nginx. But I can use internal ip in the raspi to access it. e.g. http://172.18.0.3/
    Here is the error message:
    AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message

    3. Les's encrypt was successful, but still cannot use https to access the domain. Do I need to restart nginx?

    I use Raspberry pi OS(32-bit)

    0
    chrisbeardy
    chrisbeardy

    Answer 3 months ago

    Hi, the first issue will be caused because of the OS, there is no 32 bit image of mariadb, but looks like you found one. I like to use for server applications the 64 bit Ubuntu image as it's more lightweight.

    On point two, the nginx server is not set up to forward http traffic when accessing it by local IP on your network. You will have to change the nginx proxy if you want to do that and not just get the configuration page. I have not done this but there may be some tutorials out there for this.

    On point 3, not sure what's causing this issue, you shouldn't have to restart nginx. Please check over again nginx proxy manager is set up correctly?

    I hope this helps. ;)

    0
    juaaslo
    juaaslo

    5 months ago

    Hello and many thanks!
    I deployed on a rasbPi4 and it is almost great! I realized that connecting through traefik limits my download speed to 100Mbps, but connecting directly to nextcloud container (port 9443) I can download the same file at 325Mbps, so traefik is a huge bottleneck. Anybody else has detected this issue? Any idea about traefik command or nextcloud label that could cause this?
    Besides, in my case, letsencrypt wasn't working directly (logs complained about acme.json being a directory), but setting acme.json under a directory made the trick and it worked:
    - --certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json

    In case anybody else has the same problem.

    0
    knaldhat
    knaldhat

    Reply 4 months ago

    Thanks for the guide! I also have an issue with a certificate file. This line is repeated many times in the nextcloud logs, the mariadb+traefik logs both look fine:
    nginx: [emerg] cannot load certificate "/config/keys/cert.crt": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/config/keys/cert.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file)

    0
    chrisbeardy
    chrisbeardy

    Reply 5 months ago

    thanks for your comments here, I hope these will be useful to anyone else experiencing the same issue. If I'm honest I'm not sure what would be causing this issue.

    0
    roxxov
    roxxov

    Question 5 months ago

    Hello.
    I have installed the nextcloud on my Raspi 4 with Raspberry OS Lite.
    The containers looks like there are up but i cannot acces the webinterface of the nextcloud.

    Any ideas?

    0
    chrisbeardy
    chrisbeardy

    Answer 4 months ago

    Hi, is the issue the nextcloud page is not coming up when you navigate to :9443 where the IP is the local IP of the pi on your local network? Is the hello world docker image running ok? If so I would check the required folders and docker compose carefully in case it's not set up correctly. If these are all correct and it's still not working, you could try again with the the Ubuntu image in case there is an issue with raspberry pi is image

    0
    southbook
    southbook

    8 months ago

    This is very good guide for me. And my raspi is working well. But I can't boot Nextcloud on my Kubernetes cluster(raspi) through this method because of Label name 63 character length limit. Do you have any Idea for avoid this limit?

    0
    chrisbeardy
    chrisbeardy

    Reply 8 months ago

    Hi, I'm really sorry but I've not used kubernetes before and not sure what this error is, not sure I can help with this one. I hope you get past the problem but glad the post worked for you

    0
    mack.baise
    mack.baise

    Question 10 months ago

    So, it was working, however after redeploying the containers a few times, traefik started dishing out it's default traefik cert instead of the letsencrypt one, not sure why. Anyway to prevent this?

    0
    chrisbeardy
    chrisbeardy

    Answer 10 months ago

    Not sure on this. Sounds like let's encrypt may have stopped issuing the cert. You could be hitting some sort of usage limit on certificate s from let's encrypt if the original 90 days hadn't already expired when you requested a new one.

    0
    duthie.greg
    duthie.greg

    Question 10 months ago

    Great tutorial! All came together really well, though one problem. When trying to access from my domain my browser gives me "Your connection is not private - NET::ERR_CERT_AUTHORITY_INVALID". Here is the log from traefik "command traefik error: failed to decode configuration from flags: field not found, node:".
    Any help would be greatly appreciated?

    0
    chrisbeardy
    chrisbeardy

    Answer 10 months ago

    HI, not 100% sure on this but could be a couple of things.

    I'd confirm the docker file is right, you can download the one from my github, link in instructable. My guess would be there is a config issue with traefik and that lets encrypt may not have kicked in to issue you a certificate. Also try opening up in incognito mode incase your browser cookies /cache are foolig it.

    0
    duthie.greg
    duthie.greg

    Reply 10 months ago

    Awesome! Thanks for getting back. Ill give it a go!

    0
    julian.ruess
    julian.ruess

    10 months ago

    Hey, do you know how I can redirect all HTTP traffic to HTTPS?

    Regards
    Julian

    0
    chrisbeardy
    chrisbeardy

    Reply 10 months ago

    Sorry, I am not sure how to do this for this specific application. I would start by looking at the nginx config file.

    0
    culfri
    culfri

    11 months ago

    If you want to use the local mail system rather than gmail - have a look at: http://tdongsi.github.io/blog/2017/05/25/sending-e...

    So I (using ufw) had to a) allow the docker networks to get to port 25 on localhost using UFW and b) tell postfix to allow email from the docker networks



    To open the firewall for the docker networks to the docker0 (bridge) network to the real underlying host.

    The bridge address comes from ifconfig -a:
    docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
    inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
    inet6 fe80::42:e7ff:fecc:bd73 prefixlen 64 scopeid 0x20<link>
    ether 02:42:e7:cc:bd:73 txqueuelen 0 (Ethernet)
    RX packets 210 bytes 22693 (22.1 KiB).
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 254 bytes 26829 (26.2 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    Then to enable a connection (if using ufw as I do):

    sudo ufw allow proto tcp from 172.16.0.0/12 to 172.17.0.1 port 25



    To get postfix to listen on that port, in /etc/postfix/main.cf added the networks as mynetworks:

    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/16 10.0.0.0/8 172.16.0.0/12

    restart postfix..



    In NextCloud the SMTP server with no authentication is then (in my case):

    172.17.0.1:25


    0
    Monstereye
    Monstereye

    11 months ago on Step 1

    Hello
    Really a nice tutorial and btw. working out of the box! Many many thanks.

    I found a small issue in your docker-compose.yml:
    Within the labels line of the nextcloud service you stated
    - traefik.http.middlewares.nextcloud-regex.redirectregex.replacement=https://$1/remote.php/

    At my raspi (ubuntu) the docker-compose was complaining about parsing this line.
    I added a second $ and it was not complaining any more
    - traefik.http.middlewares.nextcloud-regex.redirectregex.replacement=https://$$1/remote.php/

    Another issue was that I was wondering why my browsers are still complaining about a self signed certificate. This was (as a docker-compose logs showed) because traeffik was complaining about the user leve 775 of my created acme.json file.
    I changed it to 600 and finally everything was working fine!

    Hopefully this is helpful for somebody ... :-)

    0
    chrisbeardy
    chrisbeardy

    Reply 11 months ago

    Thanks, great spot on the $ sign!