1. Home
  2. Linux
  3. How to set up nextcloud via docker on linux

How to set up NextCloud via Docker on Linux

Nextcloud is a drop-in replacement for proprietary online services such as Google Drive, Dropbox, Microsoft OneDrive, etc. In the past, on AddictiveTips, we’ve shown you how to deploy NextCloud as a Snap. However, that’s not the only way to host a Nextcloud server. You can also do it with Docker. Here’s how.

Installing Docker on Linux

To run Nextcloud on your Linux system, you must install Docker. There are quite a few ways to get Docker working on Linux. In this guide, we’ll be setting up Docker as a Snap package.

Why Snaps? Although limited to the /root ($HOME) folder, the Docker snap is much easier to get going and requires no tinkering. In addition, it allows users to get up and running on any server system that supports Snapd.

You must first enable the Snap runtime to install Docker on your Linux system as a Snap package. You can enable the runtime by following our in-depth Snap setup guide.

Once the Snap runtime is configured and working on your Linux system, you can install Docker as a Snap using the snap install command.

sudo snap install

With the Docker tool installed as a Snap package, you can use the docker command with the root account. To do that, run the following commands.

su -
docker --help

If you cannot log into root, your Linux OS likely has the root account turned off. Log into the root (with sudo) and set the password to enable it.

sudo -s

If you wish to use Docker as a regular user rather than the root account, enter the following commands below. However, be warned, running these commands will give the typical user as much power as root.

sudo addgroup --system docker 

sudo adduser $USER docker 

newgrp docker 

sudo snap disable docker

sudo snap enable docker

Pulling the Docker Nextcloud image

You must pull the official Docker Nextcloud image from Dockerhub to run the Nextcloud server for the first time. The Nextcloud image is built on Debian stable and is very lightweight, so it will not take long to download.

To pull the image, run the following docker run -d command. This command will grab the image from Dockerhub, tell Docker to run the container on port 8080, etc.

Note: ensure you are root before running the docker run -d command.

docker run -d -p 8080:80 nextcloud

Running the container after installation

Running the Nextcloud container for the first time requires the docker run command. However, if you restart your system, you will need to run the docker start command, as Nextcloud is now a configured container.

To do this, first, run the docker ps -a command. This will show all containers available.

docker ps -a

Then, look for the “CONTAINER ID” column, find the Nextcloud container ID, and run:

docker start CONTAINER_ID

You can also stop it with:

docker stop CONTAINER_ID

Installing Nextcloud

Although the Nextcloud container is deployed, it is not yet installed. So, first, you must follow the installation wizard before using it. Follow the step-by-step instructions below to get Nextcloud working.

Step 1: Navigate to the following URL in a web browser.


Step 2: Once on the page, enter a username and password for the admin account. Be sure to enter a memorable password; if you lose it, you cannot reset it easily.

Step 3: Under the “Storage & Database” section, leave it as SQLite. Although there is a bit of a performance dip, it is excellent for small deployments at home with few users.

If you’re worried about performance, select another database backend and follow the instructions here.

Step 4: Once NextCloud is installed, you’ll log into your Admin account. Click on the admin account profile picture from here, and select “Users.”

In the “Users” area, create a new limited user account to access your Nextcloud. You may need to create multiple accounts.

Once you’ve created your user accounts, log out of admin and log into the new account to start syncing files!

Using Nextcloud

There are many ways to use Nextcloud. However, the best way is by downloading a sync client. There are desktop sync clients for Linux (Flatpak, Snap, native package), Mac OS, and Windows. Information on the desktop sync clients can be found here.

Note: do you use a mobile phone or tablet? Install the Nextcloud iOS or Android app to start syncing via your phone.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.