Nextcloud installation with Docker


基本上只要依據自己需求改動.env的參數
然後直接執行docker-compose up -d就行了吧…

.env

APP_PORT=8080
POSTGRES_HOST=nc-postgres
POSTGRES_DB=nextcloud_db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgrespasswd
REDIS_DATA=./redis
REDIS_PASSWORD=redispasswd
NC_DATA=./data
NC_EXTERNAL=./external
POSTGRES_DATA=./db

NC_EXTERNAL是額外掛載一個空間,方便讓nextcloud掛載

docker-compose.yml

version: '2'

services:
  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    restart: always
    volumes:
      - $NC_DATA:/var/www/html
      - $NC_EXTERNAL:/external
    ports:
      - $APP_PORT:80
    environment:
      - POSTGRES_HOST=$POSTGRES_HOST
      - POSTGRES_DB=$POSTGRES_DB
      - POSTGRES_USER=$POSTGRES_USER
      - POSTGRES_PASSWORD=$POSTGRES_PASSWORD
	  
    links:
      - db  
      - redis

  db:
    image: postgres:latest
    restart: always
    container_name: nextcloud-db
    hostname: 'nc-postgres' 
    volumes:
      - $POSTGRES_DATA:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=$POSTGRES_DB
      - POSTGRES_USER=$POSTGRES_USER
      - POSTGRES_PASSWORD=$POSTGRES_PASSWORD
	 
  redis:
    image: redis:latest
    container_name: nextcloud-redis
    command: redis-server --requirepass $REDIS_PASSWORD
    volumes:
      - $REDIS_DATA:/data
      - REDIS_PASSWORD=$REDIS_PASSWORD


Author: Hung-Lin, Chen
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Hung-Lin, Chen !
 Previous
自組多服務伺服器 - 軟體篇 自組多服務伺服器 - 軟體篇
作業系統 Openmediavault (OMV)其實 OMV 不是作業系統是基於 debian 的 NAS 軟體所以可以直接在 debian 或 ubuntu 安裝 OMV只是 OMV 官方有提供他們調校後的 OS 提供使用 openm
2022-03-14
Next 
自組多服務伺服器 - 硬體篇 自組多服務伺服器 - 硬體篇
Component Specification Price Comment CPU Core i3-3240T 400 TDP 35W MB GA-B75M-D3H 700 SATA3 * 1; SATA2 * 5 R
2022-03-08
  TOC