基本上只要依據自己需求改動.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