Skip to main content

Installation

OwnCloud can be installed by following the Portainer guide for creating a new stack.  Learn about configuring a Docker stacks and then use the following Docker Compose code to run this app:

---
services:
  owncloud:
    image: owncloud/server:latest
    container_name: owncloud
    restart: always
    ports:
      - ${HTTP_PORT}:8080
    depends_on:
      - mariadb
      - redis
    environment:
      - PGID=${PGID}
      - PUID=${PUID}
      - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
      - OWNCLOUD_TRUSTED_DOMAINS=${OWNCLOUD_TRUSTED_DOMAINS}
      - OWNCLOUD_DB_TYPE=${DB_TYPE}
      - OWNCLOUD_DB_NAME=${DB_NAME}
      - OWNCLOUD_DB_USERNAME=${DB_USERNAME}
      - OWNCLOUD_DB_PASSWORD=${DB_USER_PASS}
      - OWNCLOUD_DB_HOST=${DB_HOST}
      - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
      - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=${REDIS_HOST}
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      # Persistent Data
      - /srv/owncloud/config:/mnt/data

      # Media Data
      - /mnt/libraries:/mnt/libraries

  # OwnCloud Database
  mariadb:
    image: mariadb:10.6
    container_name: owncloud_mariadb
    restart: always
    command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASS}
      - MYSQL_USER=${DB_USERNAME}
      - MYSQL_PASSWORD=${DB_USER_PASS}
      - MYSQL_DATABASE=${DB_NAME}
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      # Persistent Data
      - /srv/owncloud/db:/var/lib/mysql

  # Cache Server
  redis:
    image: redis:6
    container_name: owncloud_redis
    restart: always
    command: ["--databases", "1"]
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      # Persistent Data
      - /srv/owncloud/redis:/data

For this Docker Compose code, we will also need to include environment configuration data to the stack through Portainer.

# Set Run User
PGID=1000
PUID=1000

# OwnCloud Networking
OWNCLOUD_VERSION=latest
HTTP_PORT=8080
OWNCLOUD_TRUSTED_DOMAINS=
OWNCLOUD_DOMAIN=

# Cache Server
REDIS_HOST=

# Database Configuration
DB_HOST=
DB_TYPE=
DB_NAME=
DB_USERNAME=

# Passwords
# After the initial setup, the passwords should be saved elsewhere and stack should be re-deployed with these settings deleted.

# Database Passwords
DB_ROOT_PASS=
DB_USER_PASS=

# OwnCloud Admin Account
OWNCLOUD_ADMIN_USERNAME=
OWNCLOUD_ADMIN_PASSWORD=