Guide to Getting Started with NextcloudPi Docker in 2020

Getting Started with NextcloudPi Docker in 2020

========================

I’ll do my best to be clear and thorough. Hopefully years of using these tools will help me explain this process clearly. :slight_smile:

Recommended Software before you start:

  • dd for writing images
  • gparted for partitioning disks with ease
  • bitwarden or keepassxc for maintaining passwords and other account information

Basic Layout
Note you are welcome to adapt this to whatever devices you use, be them usb drives or external disks, etc. Hopefully this acts as a decent guide regardless of your storage or which arm64 board you prefer.

  1. ARM64 sbc device with recommended 2gb of ram.
  2. True powersupply. A basic USB cable will not be enough due to the peripherals needed.
  3. eMMc card - fastest storage I have on-hand for Armbian base distribution
    • eMMc to MicroSD adapter.
    • MicroSD to USB adapter
  4. MicroSD Class 10 - separate storage for /Data/ncdata directory
  5. [optional] USB thumb drive for automated NextcloudPi backups to an additional device
  6. [optional] Serial cable for debugging with a USB cable rather than SSH or a dedicated Keyboard + monitor.

Install the latest Armbian build for your device. Skim this part if you use a Pi 4 or similar. If you don’t have a device that is 64-bit with at least 2gb of ram, it is worth the upgrade.

# armbian-config

  • Enable SSH
  • Fully update all sources and board firmware.
  • Enable Docker via 3rd party Software Sources.
  • You might notice NextcloudPi curl script available in the Armbian installer, but we are focusing on Docker instead.
  • Make sure your user is added to the Docker group so you won’t need to add sudo to your docker commands.

Adding external devices is all based on clear permissions and ownership.

$ sudo blkid
$ sudo nano /etc/fstab

fstab will persistently mount the device after it is configured: Add your device’s UUID at the end of this file. Each UUID is specific to that individual device. This is the only truly accurate option for mounting things, although you could use a label you’ve created for the device in gparted such as “memory_card”. You may also mount by the less useful, unrecommended current mount point of /dev/sbX which changes as you plug or remove things.

Once you’ve added the card you can give it sane defaults (here is ext4 example):

UUID=THE-ADDRESS-GOES-HERE /mnt/directory/location ext4 defaults 0

Now that I’ve mounted my MicroSD card to /mnt/directory/location I’ll confirm it works by reloading fstab.

$ fstab mount -a

If you see no errors you should now be able to access /mnt/directory/location on the local file system. Now we will change ownership:group to the data in this location from root to www-data since that is used by Nextcloud in Docker. See current permissions with $ ls -la /mnt/directory/location

$ sudo chown www-data:www-data -R /mnt/directory/location

Installing NextcloudPi in Docker

$ docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v /mnt/directory/location/ncdata:/data --restart unless-stopped --name nextcloudpi ownyourbits/nextcloudpi $WRITE-YOUR-IP

Docker will automatically know what architecture you are running. Note how we are defining the local storage device where our data directory will live since it is external to our docker container; this is the only way we will grant access to a real local location within our Docker Container. -v will create the new ncdata directory for us. --restart unless-stopped will keep our container running unless we specifically stop it ourselves.

In a browser you can access the IP address of your freshly installed NextcloudPi.

  • Copy all generated account credentials directly into a password manager such as Bitwarden or KeepassXC from the screen.
  • Save a copy of the credentials as a PDF if you wish.
  • Click “Activate” to create your new ncp account.

Sometimes the webui can be less easy to use. If you need to access the container, perhaps to run ncp-config from within Docker, you can execute:

$ sudo docker exec -it nextcloudpi /bin/bash
$ sudo ncp-config

Often the NextcloudPi docker containers might be a bit out-of-date so you can use the terminal interface to properly update the ncp interface along with Nextcloud itself via ncp-config. The webui looks nice, but will not recover from any errors you can otherwise fix from the terminal.

Disabling auto-backups

For versions later or equal v1.50.2, the NCP docker container will automatically create a dataless backup on startup and keep up to 5 of these in /data/docker-startup-backups. This serves as a safety measure to prevent loss of your database if something goes wrong when updating to a later docker image.
You can disable this behavior by adding -e NOBACKUP=true to your docker run command before the docker image name.

Fixing the imageck error in Admin Settings

To remove the imageck complaint you will see under Admin / Settings just log into Docker by running:

$ apt-get update && apt-get install php-imagick && exit
$ docker restart nextcloudpi

Enjoy, and thanks for reading! This should get you started. I’ll leave it to you to sort out Let’s Encrypt, Port-forwarding, and other customizations. :heart:

1 Like

Thanks alot for this post.

For me, test RPI running Docker, this works. In my case, was hitting my head up against the wall for a day with strange issues with containers not completing the INIT with persistent volumes. Seems this command was the issue.

No problem. If you run into anything else you think would benefit from clarification, reply here and I’ll try to write something up when I have time. Or, ask on https://t.me/nextcloudpi

A post was split to a new topic: Cannot find Database

@just if I understnd our discussion in the Wiki team right, this " update the ncp interface" should not be done, but only the NC version can be updated in that way. Is that correct, if so, can we remove this part so we avoid confusion? Thanks!

I’m unsure as I’m no longer actively testing or using NextcloudPi. Please update the documentation as you see fit.

1 Like