blog-image

Apr 15, 2024

16 min read

How To Install Nextcloud With Docker and Docker Compose

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 With Docker and Docker Compose?

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.
install nextcloud with docker

Install Nextcloud with Docker: Prerequisites

  • A VPS running Ubuntu 24.04, CentOS or Debian.  If you don't have one, no worries! We offer the best priced, most reliable, and fastest VPS servers in the market :)
  • A working Docker installation—for information about how to install Docker, check out our getting started with Docker tutorial.

Note

If you want to skip all the technical steps of setting up Nextcloud on your server and have it installed in minutes, then I have some great news for you! Our team of engineers has prepared a ready-to-use 1-Click Nextcloud application for your convenience. Just choose a server, and while prompted to choose the operating system, choose Nextcloud from the dropdown menu. This will set up Nextcloud in minutes, which means you don't even need this tutorial. Save time and save money with our Nextcloud 1-Click solution. [cta_inline]

Step 1. Install Docker

Ubuntu 24.04/Debian 12 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 update

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:

Ubuntu:

sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Then install docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Debian:

sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | 
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.

4 Responses to How To Install Nextcloud With Docker and Docker Compose

  1. Abhishek

    December 10, 2024 9:53 am

    Port 80 and 443 is already in use. How to use another port

    Reply
  2. Sumone

    July 4, 2024 8:36 pm

    It is crazy how nearly all Linux tutorials on the Internet skip over assumed steps and do not work following the precise steps actually listed.

    Reply
    • Marc Chartouny

      July 5, 2024 11:12 am

      Hello Sumone, thanks for your comment. We make sure to build our tutorials with much detailed and realistic steps as possible.
      Can you please help us out in highlighting the missing part so we inform our engineers to adjust it accordingly?
      Much appreciated.
      Marc

Leave a Reply