Mar 24, 2020

15 min read

How To Install Nextcloud On Your Server With Docker

Written by

Vippy The VPS

In this tutorial, we'll look at how to install Nextcloud using Docker and Docker Compose.

Specifically, we'll be installing Nexcloud along with an Nginx reverse proxy and Let’s Encrypt SSL in a CentOS, Ubuntu, or Debian dockerized environment.

Why install Nextcloud + Docker on your VPS?

Nextcloud is an open source software suite for storing and synchronizing data, sort of like a free alternative to Dropbox or Google Drive.

Plus, with Nextcloud, you get an open system architecture that gives you additional functionality and full control of your data.

With Nextcloud, you can:

  • Store files, contacts, calendars and more on your server, and synchronize them across various devices
  • Share your data with others to view and collaborate on
  • Expand your Nextcloud installation with apps from the Nextcloud App Store,
  • Or build your own apps and integrate them with Nextcloud.

Nextcloud + Docker: Prerequisites


Step 1. Install Docker

Ubuntu 18.04/Debian 10 For both Ubuntu and Debian servers, the latest versions of Docker CE may not be available in the repositories. We need to install the prerequisite packages:

sudo apt-get install curl gnupg2 apt-transport-https ca-certificates  software-properties-common

Next, we add the GPG keys, Docker repositories and finally install Docker. Here is where it gets different for both Ubuntu and Debian:


curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce


curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce

CentOS 7 The latest version of the Docker CE is not available in CentOS 7 repository. Therefore, we need to install wget and add the Docker CE repository with the following command:

$ sudo yum update
$ sudo yum install wget -y 
$ wget -O /etc/yum.repos.d/docker.repo

Now execute the following command to install Docker CE:

$ sudo yum install docker-ce –y

You can also use a one-line install script for Docker. This script is universal and works on CentOS, Ubuntu and Debian:

curl -sSL | CHANNEL=stable sh

NOTE: Whichever method used to install Docker, make sure to start the Docker service and enable it to start during system startup.

$ sudo systemctl start docker
$ sudo systemctl start docker

Step 2. Install Docker Compose

To install the latest docker-compose , execute the following commands in the terminal:

$ sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version 1.25.4, build 8d51620a

At the time of this writing, the latest stable version of docker-compose is 1.25.4, you can choose to substitute 1.25.4 with any other versions you want to install.

Step 3. Install Nextcloud

Before we start defining services in the docker-compose.yml file, we create a network so that containers can communicate. Run the following command in the terminal:

$ docker network create nextcloud_network

Since we want to containerize Nextcloud along with other containers associated with it, we will define and knit all the services together in the docker

Continue reading this article
by subscribing to our newsletter.
Subscribe now

A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.

If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.