Skip to main content

Setting Up Nextcloud with Docker Containers

Nextcloud is a powerful and open-source file hosting service that allows you to store and sync your files, contacts, calendars, and more. One of the easiest ways to deploy Nextcloud is by using Docker containers. In this tutorial, we'll guide you through the process of setting up Nextcloud with Docker.

Prerequisites

Before you begin, ensure that you have the following prerequisites installed on your machine:

  • Docker
  • Docker Compose

Step 1: Create a Docker Compose File

Start by creating a docker-compose.yml file in a directory of your choice. Use a text editor to paste the following basic configuration:

version: '3'

services:
  nextcloud:
    image: nextcloud
    ports:
      - 8080:80
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_HOST=nextcloud-db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=your_mysql_password
    depends_on:
      - nextcloud-db

  nextcloud-db:
    image: mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=your_mysql_root_password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=your_mysql_password
    volumes:
      - nextcloud-db:/var/lib/mysql

volumes:
  nextcloud:
  nextcloud-db:

Replace your_mysql_password and your_mysql_root_password with secure passwords.

Step 2: Start Docker Containers

Open a terminal, navigate to the directory with your docker-compose.yml file, and run the following command:

bash
docker-compose up -d

This command downloads the required images and starts the Nextcloud and MariaDB containers in the background.

Step 3: Access Nextcloud Setup

Open your web browser and go to http://localhost:8080. You'll be directed to the Nextcloud setup page. Complete the installation by providing the necessary information, including database details.

Step 4: Finish Installation

Complete the setup process by creating an admin account and configuring additional settings as needed.

Step 5: Access Nextcloud

After the setup is complete, you can access Nextcloud by visiting http://localhost:8080 in your web browser.

Congratulations! You've successfully installed Nextcloud using Docker containers. For more detailed configuration options or updates, refer to the official Nextcloud documentation.