docker, nextcloud, raspberrypi

NextCloudPi docker for Raspberry Pi

Note: some of this information is outdated, check a newer release here

I would like to introduce my NextCloud ARM container for the Raspberry Pi.

It only weights 475 MB, and it is shares codebase with NextCloudPi, so it has the same features:

  • Raspbian 9 Jessie
  • Nextcloud 13.0.1
  • Apache 2.4.25, with HTTP2 enabled
  • PHP 7.0
  • MariaDB 10
  • Automatic redirection to HTTPS
  • ACPU PHP cache
  • PHP Zend OPcache enabled with file cache
  • HSTS
  • Cron jobs for Nextcloud
  • Sane configuration defaults
  • Secure
  • Small, only 475 MB in disk, 162 MB compressed download.

With this containerization, the user no longer requires to start from scratch in order to run NextCloud in their RPi, as opposed from flashing the NextCloudPi image. It also opens new possibilities for easy upgrading and sandboxing for extra security.

It can be run in any system other that Raspbian, as long as it supports docker.

Some of the extras will be added soon, where it makes sense.

Installation

If you haven’t yet, install docker in your Raspberry Pi.

Adjust permissions. Assuming you want to manage it with the user pi

Optionally, store containers in an external USB drive. Change the following line (adjust accordingly)

Reload changes

You can check that it worked with

Usage

Note: some of this information is outdated, check a newer release here

The only parameter that we need is the trusted domain that we want to allow.

After a few seconds, you can access from your browser  just typing the IP or URL in the navigation bar of your browser. It will redirect you to the HTTPS site

The admin user is ncp, and the default password is ownyourbits. Login to create users, change default password and other configurations.

Other than that, we could map different ports if we wanted to. Note that a volume ncdata will be created where configuration and data will persist.

For example, you could wrap a script like this to allow your current local IP

If you ever need direct access to your storage, you can find out where your files are located.

You can in this way alter your config.php

Details

The container consists of 3 main layers, totalling 476 MB.

A benefit of docker layers is that we can sometimes just update the upper layers, or provide updates on top of the current layout.

Code

The build code is now part of the NextCloudPi repository.

You can build it yourself in a Raspbian ARM environment with.

dockerhub

Author: nachoparker

Humbly sharing things that I find useful [ github dockerhub ]

16 Comments on “NextCloudPi docker for Raspberry Pi

  1. Im gonna start from a fresh install again. should i download this? or should i install first the nextcloud 11 from previous post?

  2. I don’t see container populating mounted directory from host on rpi 2. What are the user permissions required for host directory so that it can be use by running container ?

  3. I hat it to ask for eta but do you consider to update your docker version to the newer changes that you have in the Image version? (Webinterface / Extras / Stretch)
    I use this version because I need it in background of my already configured PI with GUI, pilight, Kodi and and …

    1. Honestly, I can’t tell for sure. Maybe a month or so. I have to update miniraspbian, which is the base image for the docker container. I have a lot of work also with the regular version already because of things that I had to adjust after moving to Stretch.

      In the end, my final goal is to focus more on the docker container than the SD card, and that is why I rushed the web interface, but it is a lot to handle for a single person. Help is welcome

      1. thank you for your answer,

        I am a newbie with linux… took me some time to get Jessie and and where it is…
        With your very user friendly guides here it was easy to install docker and NC *thumbs up*

        would be nice to see someone with sufficient knowledge helping you

  4. Hi, when I use this docker image I get:

    docker logs -f nextcloudpi
    /run-parts.sh: line 43: /etc/services-enabled.d/010lamp: Permission denied
    /run-parts.sh: line 43: /etc/services-enabled.d/020nextcloud: Permission denied
    Init done

    Any ideas?

    Thank you

  5. This tutorial seems to be aimed at people with moderate linux and docker experience. However, the overall project is aimed at making nextcloud accessible to the most non-technical users. I realise there might be practical limits to this but here are some improvements I’d suggest.

    “Change the following line (adjust accordingly)
    /lib/systemd/system/docker.service

    ExecStart=/usr/bin/dockerd -g /media/USBdrive/docker -H fd://

    This is not so helpful to those who don’t know “according” to what.
    This would be a reasonable thought process for a newbie:
    “I found out that my usb drive is under media and it is not named USBdrive so the tutorial probably expects me to change that bit to the name of mine. But what about the “/docker” bit? Do I have to make a folder with that name? Do I have to make a drive partition with that name? Is it ok to use a different name?”
    An even less experienced but observant user may reasonably ask “Where it says “\usr…” should I change it to my username?” and they may even try to execute the line in the terminal, not noticing or realising the code snippet frame is shorthand for “go and edit the file at /lib/systemd/system/docker.service”

    This is all reasonable shorthand for an audience with some experience in linux but it would be good if it were not the only instruction set available for newbies who want to do such a common thing as store their nextcloud data on an external drive.

    Thanks for writing it nevertheless. 🙂

  6. Please update this post since the container ownyourbits/nextcloudpi doesn’t exist anymore. The name has changed to ownyourbits/nextcloudpi-armhf.

    On ownyourbits/nextcloudpi-armhf docker page, I notice a typo. In the description, the architecture should be ARM not x86

Leave a Reply

Your email address will not be published. Required fields are marked *