# ownCloud

> File sync and share platform for enterprise.

- Category: Storage & Backup
- Difficulty: intermediate
- Components: owncloud, mariadb, redis
- Tags: owncloud, sync, share, enterprise
- Source: https://docker.recipes/storage/owncloud

## Overview

ownCloud is an open-source file synchronization and sharing platform that enables organizations to maintain complete control over their data while providing Dropbox-like functionality. Originally founded in 2010 as a response to growing privacy concerns with cloud storage providers, ownCloud allows enterprises to host their own private cloud storage infrastructure, ensuring data sovereignty and compliance with strict regulatory requirements. The platform supports file versioning, collaborative editing, and extensive third-party integrations while maintaining enterprise-grade security features. This Docker stack combines ownCloud with MariaDB as the primary database backend and Redis for high-performance caching and session management. MariaDB provides robust data storage with its enhanced MySQL-compatible engine, offering better performance and additional features like the Aria storage engine for improved crash recovery. Redis accelerates the ownCloud experience by caching frequently accessed data, managing user sessions, and enabling real-time features through its sub-millisecond response times. This combination is ideal for organizations seeking a self-hosted alternative to commercial cloud storage solutions, particularly those in regulated industries like healthcare, finance, or government sectors where data locality and privacy are paramount. The stack scales effectively from small team deployments to enterprise installations supporting thousands of users, making it valuable for companies transitioning away from external cloud providers or establishing hybrid cloud strategies.

## Features

- File versioning and conflict resolution with automatic backup retention policies
- External storage integration supporting FTP, SMB/CIFS, SharePoint, and object storage backends
- MariaDB Aria storage engine providing crash-safe tables with better recovery capabilities
- Redis-powered session clustering enabling horizontal scaling across multiple ownCloud instances
- Built-in antivirus scanning integration with ClamAV for uploaded file security
- LDAP and Active Directory authentication with group-based access controls
- WebDAV protocol support for native desktop integration and third-party client compatibility
- Federated sharing capabilities allowing secure file sharing between different ownCloud instances

## Use cases

- Healthcare organizations needing HIPAA-compliant file storage with audit trails
- Financial institutions requiring SOX compliance for document management and retention
- Educational institutions providing secure file sharing for students and faculty
- Government agencies maintaining data sovereignty while enabling remote collaboration
- Law firms managing confidential client documents with granular access permissions
- Manufacturing companies sharing CAD files and technical documentation across global teams
- Small businesses replacing expensive enterprise storage solutions with self-hosted alternatives

## Prerequisites

- Minimum 2GB RAM (4GB+ recommended for production with multiple concurrent users)
- Port 8080 available for web interface access
- Basic understanding of file permission management and user access controls
- SSL certificate and reverse proxy knowledge for production HTTPS deployment
- Backup strategy planning for both database and file storage volumes
- Network configuration knowledge for trusted domains and client synchronization

## docker-compose.yml

```yaml
services:
  owncloud:
    image: owncloud/server:latest
    container_name: owncloud
    restart: unless-stopped
    environment:
      OWNCLOUD_DOMAIN: localhost:8080
      OWNCLOUD_TRUSTED_DOMAINS: localhost
      OWNCLOUD_DB_TYPE: mysql
      OWNCLOUD_DB_NAME: owncloud
      OWNCLOUD_DB_USERNAME: owncloud
      OWNCLOUD_DB_PASSWORD: ${DB_PASSWORD}
      OWNCLOUD_DB_HOST: mariadb
      OWNCLOUD_ADMIN_USERNAME: ${ADMIN_USER}
      OWNCLOUD_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      OWNCLOUD_REDIS_ENABLED: true
      OWNCLOUD_REDIS_HOST: redis
    volumes:
      - owncloud_data:/mnt/data
    ports:
      - "8080:8080"
    depends_on:
      - mariadb
      - redis
    networks:
      - owncloud

  mariadb:
    image: mariadb:10.11
    container_name: owncloud-mariadb
    restart: unless-stopped
    environment:
      MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
      MARIADB_DATABASE: owncloud
      MARIADB_USER: owncloud
      MARIADB_PASSWORD: ${DB_PASSWORD}
    volumes:
      - mariadb_data:/var/lib/mysql
    networks:
      - owncloud

  redis:
    image: redis:alpine
    container_name: owncloud-redis
    restart: unless-stopped
    networks:
      - owncloud

volumes:
  owncloud_data:
  mariadb_data:

networks:
  owncloud:
    driver: bridge
```

## .env

```bash
DB_ROOT_PASSWORD=rootpassword
DB_PASSWORD=owncloud
ADMIN_USER=admin
ADMIN_PASSWORD=changeme
```

## Usage notes

- Docs: https://doc.owncloud.com/
- Access at http://localhost:8080 - login with ADMIN_USER/PASSWORD
- Desktop sync clients: https://owncloud.com/desktop-app/
- Mobile apps for iOS and Android
- OWNCLOUD_TRUSTED_DOMAINS: add your domain for production
- Enterprise features: audit logs, workflows, Collabora integration

## Troubleshooting

- Database connection failed: Verify MariaDB container is running and DB_PASSWORD matches between services
- Trusted domain error: Add your server's domain/IP to OWNCLOUD_TRUSTED_DOMAINS environment variable
- File upload fails on large files: Increase PHP memory limit and upload size in ownCloud configuration
- Desktop client sync issues: Check firewall settings and ensure WebDAV ports are accessible
- Redis connection timeout: Verify Redis container health and network connectivity between services
- Permission denied on file operations: Check owncloud_data volume permissions and container user mapping

