Jevy Wang's Blog

Install owncloud with docker and local directory

I was struggled on installing owncloud barely on ubuntu 18, and spent hours on install and config its dependencies, but failed on database script execution.

During googling to solve my problem, I noticed a dockerized owncloud, and find it’s pretty easy to setup.

Here is the installation/configuration log:

Install docker and docker-compose

Prepare a docker-compose.yml :

Referenced this Installing with Docker
and this yml file to make my own docker-compose.yml file.

Because I have a RDS instance on cloud, and a NAS storage mounted on this server, I was wondering to reuse them. So I removed the volumns and db dependencies from the yml file.
Becuase this owncloud file sharing will be used by very few users, and the VM will have extra charge for CPU usage, I removed redis.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
version: '2.1'

services:
owncloud:
image: owncloud/server:10.0
restart: always
ports:
- 8080:8080
environment:
- OWNCLOUD_DOMAIN=localhost
- OWNCLOUD_DB_TYPE=mysql
- OWNCLOUD_DB_NAME=db_name
- OWNCLOUD_DB_USERNAME=db_username
- OWNCLOUD_DB_PASSWORD=db_password
# db can be any remote url with accessing privilidge
- OWNCLOUD_DB_HOST=db_url
- OWNCLOUD_ADMIN_USERNAME=admin
- OWNCLOUD_ADMIN_PASSWORD=admin
# for owncloud >= 9.0, add this config to allow local directory as external storage
- OWNCLOUD_ALLOW_EXTERNAL_LOCAL_STORAGE=true
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- /mnt/data/owncloud:/mnt/data
- /other-directory1:/mnt/data/d1
- /other-directory2:/mnt/data/d2

Use command sudo docker-compose up -d to start owncloud, and access it through server_ip:8080.
Please add port 8080 to your VM’s network route rule.

Add local storage :

Reference this Local storage to add local directory.

usefull notes

  • scan files copied to owncloud directory: docker-compose exec owncloud occ files:scan --all

专题:

本文发表于 2020-03-12,最后修改于 2020-03-13。

本站永久域名jevy.wang,也可搜索「 Jevy Wang's Blog 」找到我。

期待关注我的 知乎专栏 ,查看最近的文章和动态。


上一篇 « Package AWS Lambda function 下一篇 » Add an image layer to react mapbox gl

赞赏支持

请我吃胡萝卜 =^_^=

i ali

支付宝

i wechat

微信

推荐阅读

Big Image