Sign inSign up

kbitc/owncloud

By kbitc

•Updated over 1 year ago

Custom ownCloud server on Alpine Linux with Nginx & PHP-FPM. Supports SQLite, MySQL, PostgreSQL.

Image
0

1.3K

kbitc/owncloud repository overview

⁠Custom ownCloud Server Docker Image

⁠Overview

This Docker image provides a flexible and self-hostable ownCloud server instance. It is built on Alpine Linux for a minimal footprint, uses Nginx + PHP-FPM for serving ownCloud, and supervisord for process management.

The image supports multiple database backends (SQLite, MySQL/MariaDB, PostgreSQL) and can be configured for fully automated installation via environment variables or allow setup through the standard ownCloud web-based wizard.

⁠Features

  • Application: ownCloud Server (version specified during build, e.g., 10.13.4)
  • Base Image: Alpine Linux (lightweight and security-focused)
  • Web Server: Nginx
  • PHP: PHP-FPM (version configured during build, e.g., PHP 7.4)
  • Process Management: Supervisord (manages Nginx and PHP-FPM)
  • Database Support:
    • SQLite (for simple, single-user setups)
    • MySQL/MariaDB (recommended for multi-user/production)
    • PostgreSQL (recommended for multi-user/production)
  • Flexible Setup:
    • Automated Installation: Provide all necessary environment variables (admin user/pass, database type & credentials) for a complete, unattended setup on first run.
    • Web-based Setup: Omit key environment variables to launch the standard ownCloud web installation wizard.
  • Configurable via Environment Variables: Control database type, connection details, initial admin user, trusted domains, and more.
  • Persistent Storage: Uses Docker volumes to persist ownCloud data, configuration, custom apps, and themes.
  • Security Headers: Nginx configuration includes common security headers (X-Content-Type-Options, X-Frame-Options, X-XSS-Protection).
  • Memory Caching: Configured to use APCu for local caching and transactional file locking by default after automated installation.

⁠Prerequisites

  • Docker installed.
  • docker-compose installed (recommended for easier management).
  • Host directories prepared for persistent volumes.

⁠Quick Start (Using docker-compose)

This is the recommended method for running the ownCloud server, especially when using an external database like MariaDB or PostgreSQL.

  1. Prepare Host Directories: Create directories on your Docker host to store persistent data (e.g., in your current project directory):

    mkdir -p ./owncloud_data/app/config
    mkdir -p ./owncloud_data/app/data
    mkdir -p ./owncloud_data/app/apps
    mkdir -p ./owncloud_data/app/themes
    mkdir -p ./owncloud_data/db # For MariaDB/PostgreSQL data if co-deployed
    
  2. Create docker-compose.yml:

    Example for MariaDB:

    version: '3.8'
    
    services:
      owncloud_db:
        image: mariadb:10.11 # Or your preferred MariaDB version
        container_name: owncloud_mariadb_db
        restart: always
        command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-read-only-compressed=OFF
        volumes:
          - ./owncloud_data/db:/var/lib/mysql
        environment:
          - MYSQL_ROOT_PASSWORD=VERY_STRONG_ROOT_PASSWORD # <<< CHANGE THIS!
          - MYSQL_DATABASE=owncloud_db
          - MYSQL_USER=owncloud_user
          - MYSQL_PASSWORD=VERY_STRONG_USER_PASSWORD # <<< CHANGE THIS!
        networks:
          - owncloud_network
    
      owncloud_app:
        image: kbitc/owncloud:latest
        container_name: owncloud_app_instance
        restart: always
        depends_on:
          - owncloud_db
        ports:
          - "8080:80" # Map host port 8080 to container port 80 (HTTP)
        volumes:
          - ./owncloud_data/app/config:/var/www/owncloud/config
          - ./owncloud_data/app/data:/var/www/owncloud/data
          - ./owncloud_data/app/apps:/var/www/owncloud/apps
          - ./owncloud_data/app/themes:/var/www/owncloud/themes
        environment:
          # --- To trigger automatic installation (all must be set for mysql/pgsql) ---
          - ADMIN_USER=admin
          - ADMIN_PASS=ChangeThisAdminPassword! # <<< CHANGE THIS!
          - DB_TYPE=mysql
          - DB_HOST=owncloud_db # Service name of the database container
          - DB_NAME=owncloud_db
          - DB_USER=owncloud_user
          - DB_PASS=VERY_STRONG_USER_PASSWORD # Should match MYSQL_PASSWORD above
          # - DB_TABLE_PREFIX=oc_ # Optional
          # - DB_PORT=3306 # Optional, if not default
    
          # --- OR Omit ADMIN_USER, ADMIN_PASS, DB_TYPE etc. for Web-based Setup ---
          # If the above are not set, the web installer will launch.
    
          # --- General ownCloud Settings ---
          # Comma-separated list of domains used to access ownCloud
          - OWNCLOUD_TRUSTED_DOMAINS=localhost,192.168.3.8 # CHANGE to your actual IP/domain
          # For use behind a reverse proxy handling HTTPS:
          # - OWNCLOUD_OVERWRITE_PROTOCOL=https
        networks:
          - owncloud_network
    
    networks:
      owncloud_network:
        driver: bridge
    
  3. Start ownCloud:

    docker-compose up -d
    # If using 'build: .' for the first time or after Dockerfile changes:
    # docker-compose up --build -d
    

    Access via http://<your_host_ip>:8080 or http://localhost:8080.


To use PostgreSQL: Modify the owncloud_db service in docker-compose.yml:

# ...
      owncloud_db:
        image: postgres:15-alpine # Or your preferred PostgreSQL version
        container_name: owncloud_postgres_db
        restart: always
        volumes:
          - ./owncloud_data/db:/var/lib/postgresql/data # Note different path
        environment:
          - POSTGRES_DB=owncloud_db
          - POSTGRES_USER=owncloud_user
          - POSTGRES_PASSWORD=VERY_STRONG_USER_PASSWORD # <<< CHANGE THIS!
# ...

Tag summary

Content type

Image

Digest

sha256:dcf190b51…

Size

210.1 MB

Last updated

over 1 year ago

docker pull kbitc/owncloud