apt install docker.io
# 创建或修改 /etc/docker/daemon.json 文件,修改为如下形式
#vim /etc/docker/daemon.json
{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com",
"https://cr.console.aliyun.com/"
]
}
systemctl restart docker.service
apt install docker-compose
mkdir owncloud-docker-server
cd owncloud-docker-server
wget https://raw.githubusercontent.com/owncloud/docs/master/modules/admin_manual/examples/installation/docker/docker-compose.yml
有的朋友无法访问上面的连接这里提供了yaml配置,如下所示:
#vim docker-compose.yml
version: '2.1'
volumes:
files:
driver: local
mysql:
driver: local
backup:
driver: local
redis:
driver: local
services:
owncloud:
image: owncloud/server:${OWNCLOUD_VERSION}
restart: always
ports:
- ${HTTP_PORT}:8080
depends_on:
- db
- redis
environment:
- OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
- OWNCLOUD_DB_TYPE=mysql
- OWNCLOUD_DB_NAME=owncloud
- OWNCLOUD_DB_USERNAME=owncloud
- OWNCLOUD_DB_PASSWORD=owncloud
- OWNCLOUD_DB_HOST=db
- OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
- OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
- OWNCLOUD_MYSQL_UTF8MB4=true
- OWNCLOUD_REDIS_ENABLED=true
- OWNCLOUD_REDIS_HOST=redis
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- files:/mnt/data
db:
image: webhippie/mariadb:latest
restart: always
environment:
- MARIADB_ROOT_PASSWORD=owncloud
- MARIADB_USERNAME=owncloud
- MARIADB_PASSWORD=owncloud
- MARIADB_DATABASE=owncloud
- MARIADB_MAX_ALLOWED_PACKET=128M
- MARIADB_INNODB_LOG_FILE_SIZE=64M
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- mysql:/var/lib/mysql
- backup:/var/lib/backup
redis:
image: webhippie/redis:latest
restart: always
environment:
- REDIS_DATABASES=1
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- redis:/var/lib/redis
cat << EOF > .env
OWNCLOUD_VERSION=10.5
OWNCLOUD_DOMAIN=localhost
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
HTTP_PORT=8080
EOF
docker-compose up -d
docker-compose ps
如下所示结果,即为成功启动
Name Command State Ports
__________________________________________________________________________________________
ownclouddockerserver_db_1 … /bin/s6-svscan /etc/s6 Up 3306/tcp
ownclouddockerserver_owncloud_1 … /usr/bin/owncloud server Up 0.0.0.0:8080->8080/tcp
ownclouddockerserver_redis_1 … /bin/s6-svscan /etc/s6 Up 6379/tcp
浏览器访问http://IP:8080 账号和密码在.env 文件中配置了即admin admin
查看数据本地存储位置
docker volume ls
查看详情
DRIVER VOLUME NAME
local owncloud-docker-server_backup
local owncloud-docker-server_files
local owncloud-docker-server_mysql
local owncloud-docker-server_redis
docker volume inspect owncloud-docker-server_files
可以看到/var/lib/docker/volumes/owncloud-docker-server_files/_data就是owncloud本地数据存放的位置
[
{
"CreatedAt": "2020-08-24T22:45:17+08:00",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "owncloud-docker-server",
"com.docker.compose.version": "1.25.0",
"com.docker.compose.volume": "files"
},
"Mountpoint": "/var/lib/docker/volumes/owncloud-docker-server_files/_data",
"Name": "owncloud-docker-server_files",
"Options": null,
"Scope": "local"
}
]